Skip to content
  • 58 Topics
    77 Posts
    rickR

    Screen recording can use webm as their format, it can be more simple to use a gif to embed into a website or forum, than adding scripts to host different video format.

    In this case I grabbed a screen record of the progress for writing zeros to a hard drive with dd

    Use ffmpeg to convert webm to gif:

    First create a pallet:

    Move into the directory which the webm is located, or type in the path

    Where ‘dd.webm’ is the screen recording

    ffmpeg -y -i dd.webm -vf palettegen palette.png

    Output:

    dd-ffmpeg.png

    Then convert the webm to gif:

    ffmpeg -y -i dd.webm -i palette.png -filter_complex paletteuse -r 10 dd.gif

    dd-webm-2.png

    This is what I ended up with, looks like any image of any alien on the interwebz, as if shot through a potato, some tweaking of the command is in my future. None the less.

    dd.gif

  • FreeBSD Notes

    10 Topics
    15 Posts
    rickR

    Locate devices:

    camcontrol devlist

    Output; in this case only:

    <ST3500418AS CC35> at scbus3 target 0 lun 0 (pass0,ada0) <ST500DM002-1BD142 KC45> at scbus5 target 0 lun 0 (pass1,ada1) <AHCI SGPIO Enclosure 1.00 0001> at scbus9 target 0 lun 0 (ses0,pass2) <Generic STORAGE DEVICE 1532> at scbus10 target 0 lun 0 (da0,pass3) <Generic STORAGE DEVICE 1532> at scbus10 target 0 lun 1 (da1,pass4)

    Where ada0 and ada1 are mechanical drives, da0 is a miniSD card in a USB enclosure da1

    Or to print all partitions:

    gpart show

    Output (after formatting USB device):

    => 63 976773105 ada0 MBR (466G) 63 1 - free - (512B) 64 976773096 1 freebsd [active] (466G) 976773160 8 - free - (4.0K) => 0 976773096 ada0s1 BSD (466G) 0 4194304 1 freebsd-zfs (2.0G) 4194304 4194304 2 freebsd-swap (2.0G) 8388608 968384480 4 freebsd-zfs (462G) 976773088 8 - free - (4.0K) => 63 976773105 ada1 MBR (466G) 63 1 - free - (512B) 64 976773096 1 freebsd [active] (466G) 976773160 8 - free - (4.0K) => 0 976773096 ada1s1 BSD (466G) 0 4194304 1 freebsd-zfs (2.0G) 4194304 4194304 2 freebsd-swap (2.0G) 8388608 968384480 4 freebsd-zfs (462G) 976773088 8 - free - (4.0K) => 32 2012128 da0 MBR (983M) 32 2012128 1 fat32 (982M)

    List partitions on dev da0:

    gpart show da0

    Delete existing partitions:

    gpart delete -i da0

    Destroy label:

    gpart destroy da0

    Create new mbr spanning entire disk:

    gpart create -s mbr da0

    Create new fat32 partition spanning entire disk:

    gpart add -t fat32 da0

    Initialize fat32 file system:

    newfs_msdos -F32 /dev/da0s1

    Lets break something!

    Don’t do any of this unless you are prepared to break it all, or better yet, you read the man pages and find out what they actually do, very useful tools however.

    I’m just making notes from other notes, various resources on the net.

    gpart destroy -F da0

    Zero out the drive === !!!Don’t do this jazz regularly on any USB!!! The type of memory has a finite read/write number===

    dd if=/dev/zero of=/dev/da0 bs=2m count=1

    Format the drive

    newfs_msdos -F32 /dev/da0s1
  • Android hacks

    1 Topics
    1 Posts
    rickR

    Install adb:

    On Debian:

    sudo apt install android-tools-adb

    If your running Ubuntu:

    sudo apt install adb

    Place your Android device in Developer Mode: Go to settings > About Phone> and tap on this several consecutive times (maybe 5) You’ll see a note stating developer options have been enabled.

    Now go back to your settings, and you’ll see ‘Developer Options’

    (Make sure your connected to the machine via USB cable)

    !Go into Android developer options, and allow USB debugging

    If your Android device is attached as a camera, you’ll get a warning in the command line something to the effect of:

    adb: unable to connect for backup

    Or complaints about the fact there is nothing for the server to connect to. If so, the Android is connected as PTP and needs to be changed.

    Once the server is running, and the Android is available as a media device (MTP)

    Go to your command line and type:

    adb start-server

    Output:

    * daemon not running. starting it now on port 5037 * * daemon started successfully *

    Unlock the Android device and accept the RSA key from the machine you are running adb from. You will be asked to do so before moving further:

    Allow USB debugging? Click OK

    Now the two devices are connected.

    The command to backup all files on the Android device is as follows:

    adb backup -apk -shared -all -f my-android-backup.adb

    You can change “my-android-backup” to anything you wish, just insure the file extension is adb.

    You will be asked to create an encrypted file, if your device is not already encrypted, just type in a password you will remember!

    If your device is already encrypted, you will be required to encrypt the backup.

    The backup time will depend obviously how much you have ‘collected’ on your device, with no real vision of progress, so chill and leave it alone. ADB will quit when done.

    The backup file will be located in the user directory ( or wherever you were when you took the backup)

    To restore this backup, is just as simple, connect, and run:

    adb restore my-android-backup.adb

    Fin!

  • 1 Topics
    1 Posts
    rickR
    enable conf t int vlan1 no shut end copy run start

    Check your work

    sh ip int bri vlan1

    Output:

    Interface IP-Address OK? Method Status Protocol Vlan1 192.168.0.101 YES NVRAM up up
FreeBSD Notes
  • rickR

    Screen recording can use webm as their format, it can be more simple to use a gif to embed into a website or forum, than adding scripts to host different video format.

    In this case I grabbed a screen record of the progress for writing zeros to a hard drive with dd

    Use ffmpeg to convert webm to gif:

    First create a pallet:

    Move into the directory which the webm is located, or type in the path

    Where ‘dd.webm’ is the screen recording

    ffmpeg -y -i dd.webm -vf palettegen palette.png

    Output:

    dd-ffmpeg.png

    Then convert the webm to gif:

    ffmpeg -y -i dd.webm -i palette.png -filter_complex paletteuse -r 10 dd.gif

    dd-webm-2.png

    This is what I ended up with, looks like any image of any alien on the interwebz, as if shot through a potato, some tweaking of the command is in my future. None the less.

    dd.gif

    read more

  • rickR

    Write zeros to all sectors

    Use the command ‘lsblk’ to find the drive you wish to erase

    I’m using ‘dd’ to erase things

    In this case I’m torching sdb

    Only use status=progress if you care it’s not necessary

    dd if=/dev/zero of=/dev/sdb bs=12M status=progress

    dd.gif

    read more

  • rickR

    Remove old kernel images that are cluttering the system

    zstd-no-space-error.png

    Most of these errors are due to low or not enough space left in the root partition.

    If you are using a Debian flavor:

    sudo apt-get autoremove --purge

    zstd-error.png

    Inform grub whenever an old kernel is removed:

    update grub

    update-grub.png

    Remove the un-used kernel config files:

    These will be the files pre cursed as ‘rc’ where installed kernels use ‘ii’

    … As well as files no longer used or required due to dependencies

    This command will detect, print, and remove left over cruft from previously installed packages or scripts, that have been removed or updated.

    sudo dpkg --purge $(dpkg -l | awk '/^rc/{print $2}')

    purge.png

    You can re-run the following to view the installed kernel(s):

    dpkg --list | grep linux-image

    installed-kernels.png

    read more

  • rickR

    New script due to dependency changes:

    #! /bin/sh set -e

    if [ “$1” = “install” ] || [ “$1” = “upgrade” ]; then

    ACTION=$1

    elif [ “$1” = “” ]; then ACTION=install else echo “usage: $(basename $0) action [source]” echo “action is either install (default) or upgrade” echo “source is either tar (default) or git” exit 1 fi

    if [ “$2” = “git” ] || [ “$2” = “tar” ]; then SOURCE=$2 elif [ “$2” = “” ]; then SOURCE=tar else echo “Unknown source $2!” exit 1 fi

    if [ “$BPC_UID” ] && [ $(getent passwd “$BPC_UID” | cut -d ‘:’ -f 1) != “backuppc” ]; then echo “The uid = $BPC_UID is already in use!” exit 1 fi

    #Install dependencies

    apt-get -q update export DEBIAN_FRONTEND=noninteractive apt-get install -q -y apache2 apache2-utils libapache2-mod-perl2 par2 perl smbclient rsync tar gcc zlib1g zlib1g-dev rrdtool git make perl-doc libarchive-zip-perl libfile-listing-perl libxml-rss-perl libcgi-session-perl libacl1-dev wget iputils-ping pwgen

    #Set up backuppc user and directory

    if ! id backuppc >/dev/null 2>&1; then if [ “$BPC_UID” ]; then adduser --system --home /var/lib/backuppc --group --disabled-password --shell /bin/false --uid=“$BPC_UID” backuppc else adduser --system --home /var/lib/backuppc --group --disabled-password --shell /bin/false backuppc fi fi mkdir -p /var/lib/backuppc/.ssh chmod 700 /var/lib/backuppc/.ssh echo -e “BatchMode yes\nStrictHostKeyChecking no” > /var/lib/backuppc/.ssh/config if [ ! -e /var/lib/backuppc/.ssh/id_rsa ]; then ssh-keygen -q -t rsa -b 4096 -N ‘’ -C “BackupPC key” -f /var/lib/backuppc/.ssh/id_rsa fi chmod 600 /var/lib/backuppc/.ssh/id_rsa chmod 644 /var/lib/backuppc/.ssh/id_rsa.pub chown -R backuppc:backuppc /var/lib/backuppc/.ssh

    #Set password or read password file

    if [ “$BPC_PASS” ]; then PASSWORD=“$BPC_PASS” elif [ -e /root/password ]; then PASSWORD=$(cat /root/password) chmod 600 /root/password else PASSWORD=$(pwgen -s -1 32) echo “$PASSWORD” > /root/password chmod 600 /root/password fi echo “backuppc:$PASSWORD” | chpasswd backuppc

    #Get BackupPC release versions

    get_latest_release() { wget -q -O - “https://api.github.com/repos/$1/releases/latest” | grep ‘“tag_name”:’ | sed -E ‘s/.“([^”]+)"./\1/’
    } bpcver=$(get_latest_release “backuppc/backuppc”) bpcxsver=$(get_latest_release “backuppc/backuppc-xs”) rsyncbpcver=$(get_latest_release “backuppc/rsync-bpc”)

    mkdir -p /tmp/bpc cd /tmp/bpc

    if [ $SOURCE = “tar” ]; then

    ##Fetch and install latest stable releases

    wget https://github.com/backuppc/backuppc-xs/releases/download/$bpcxsver/BackupPC-XS-$bpcxsver.tar.gz wget https://github.com/backuppc/rsync-bpc/releases/download/$rsyncbpcver/rsync-bpc-$rsyncbpcver.tar.gz wget https://github.com/backuppc/backuppc/releases/download/$bpcver/BackupPC-$bpcver.tar.gz tar -zxf BackupPC-XS-$bpcxsver.tar.gz tar -zxf rsync-bpc-$rsyncbpcver.tar.gz tar -zxf BackupPC-$bpcver.tar.gz cd BackupPC-XS-$bpcxsver perl Makefile.PL make make test make install cd …/rsync-bpc-$rsyncbpcver ./configure make make install cd …/BackupPC-$bpcver fi

    if [ $SOURCE = “git” ]; then

    #Fetch and install the latest development code instead

    git clone https://github.com/backuppc/backuppc.git git clone https://github.com/backuppc/backuppc-xs.git git clone https://github.com/backuppc/rsync-bpc.git cd backuppc-xs perl Makefile.PL make make test make install cd …/rsync-bpc ./configure make make install cd …/backuppc ./makeDist --nosyntaxCheck --releasedate “date -u "+%d %b %Y"” --version ${bpcver}git tar -zxf dist/BackupPC-${bpcver}git.tar.gz cd BackupPC-${bpcver}git fi

    if [ $ACTION = “install” ]; then ./configure.pl --batch --cgi-dir /var/www/cgi-bin/BackupPC --data-dir /var/lib/backuppc --hostname backuppc --html-dir /var/www/html/BackupPC --html-dir-url /BackupPC --install-dir /usr/local/BackupPC fi

    if [ $ACTION = “upgrade” ]; then ./configure.pl --batch --config-path /etc/BackupPC/config.pl fi

    #Set up web server #Note that changing the apache user and group (/etc/apache2/envvars) could cause other services #provided by apache to fail. There are alternatives if you don’t want to change the apache #user: use SCGI or a setuid BackupPC_Admin script - see the docs. cp httpd/BackupPC.conf /etc/apache2/conf-available/backuppc.conf sed -i “/Require local/d” /etc/apache2/conf-available/backuppc.conf sed -i “s/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=backuppc/” /etc/apache2/envvars sed -i “s/export APACHE_RUN_GROUP=www-data/export APACHE_RUN_GROUP=backuppc/” /etc/apache2/envvars echo ‘’ > /var/www/html/index.html a2enconf backuppc a2enmod cgid service apache2 restart

    #Set up backuppc service

    cp systemd/init.d/debian-backuppc /etc/init.d/backuppc

    chmod 755 /etc/init.d/backuppc

    update-rc.d backuppc defaults

    chmod u-s /var/www/cgi-bin/BackupPC/BackupPC_Admin

    touch /etc/BackupPC/BackupPC.users

    sed -i “s/$Conf{CgiAdminUserGroup}.*/$Conf{CgiAdminUserGroup} = ‘backuppc’;/” /etc/BackupPC/config.pl

    sed -i “s/$Conf{CgiAdminUsers}.*/$Conf{CgiAdminUsers} = ‘backuppc’;/” /etc/BackupPC/config.pl

    chown -R backuppc:backuppc /etc/BackupPC

    echo $PASSWORD | htpasswd -i /etc/BackupPC/BackupPC.users backuppc

    service backuppc start

    #Clean up

    cd rm -rf /tmp/bpc echo “All done!” exit 0

    read more

  • rickR

    To list all files in current directory including dot files (hidden files or directories), as well as print permissions :

    ls -la
    read more