Bitlebee/IRC info
Tyler Cipriani Posted

Helpful Posts

- pthree.org post

  • Datko's book has this same kinda stuff.

Restart bitlbee without restarting Weechat

sudo service bitlbee stop
/disconnect localhost
sudo service bitlbee start
/connect localhost/6667
/msg &bitlbee identify [password]

Setup OTR

First had to install the bitlbee-plugin-otr plugin:

sudo apt-get install bitlbee-plugin-otr

In the &bitlebee window

account list
> @root 0 (gtalk): jabber, thcipriani@gmail.com (connected)
> @root 1 (twitter): twitter, thcipriani (connected)

Will return a list of accounts that are currently setup in bitlbee.

To generate a key for the 0th account—gmail in my case:

otr keygen 0
License: Creative Commons Attribution-ShareAlike License
VHS to MP4 on Linux
Tyler Cipriani Posted

I recently ordered a set of videos that I remember from a few years ago that did not make the jump to DVD, unfortunately.

I do have a VCR; however, I never have it hooked up because…why would I?

The solution here: convert my VHS tapes into H.264/MP3 mp4-contained files.

Now the question is: how?

Hardware

I managed to grab an EasyCap D60 Recording device from Amazon.

This device is supported inside the linux kernel (from version 3.18 forward…maybe?)

Once I plugged in this device, it was working:

lsusb

This bad boy:

Bus 1 Device 016: ID 1b71:3002 Fushicai USBTV007 Video Grabber [EasyCAP]

I checked out:

ls /dev | grep -i video

And I noticed a new video device video1. Easy.

Capture Software

I used VLC to caputre raw input.

  1. MediaOpen Caputre Device
  2. Video Device Name/dev/video1
  3. Audio Device Namehw:2,0
  4. Play pulldown menu → Convert
  5. Dump Raw Input
  6. Destination File/home/tyler/Videos
  7. Start
  8. Hit play on the VCR
  9. Hit the Rec. button in VLC

The auto-named avi file in ~/Videos was FUCKING HUGE.

ls -lh ~/Videos | grep -i avi

Conversion

I found a blog where a person does this. I have a vauge memory about doing this at UpSync, so I'll give it a shot: 2-pass mp4 conversion.

Let's see what happens!

ffmpeg -i ~/Videos/vlc-record-2016-04-22-14h47m57s-Streaming-.avi -c:v libx264 -pix_fmt yuv420p -preset slow -threads 0 -b:v 825k -strict -2 -c:a aac -b:a 96k -pass 1 -f mp4 -y /dev/null
ffmpeg -i ~/Videos/vlc-record-2016-04-22-14h47m57s-Streaming-.avi -c:v libx264 -pix_fmt yuv420p \
  -preset slow -threads 0 -b:v 825k -strict -2 -c:a aac -b:a 96k -pass 2 ~/Videos/out.mp4

The settings above created an mp4 that could be played via x264 on a RaspberryPi 3.

License: Creative Commons Attribution-ShareAlike License
Beaglebone Black Setup on Debian 8
Tyler Cipriani Posted

Flash eMMC with latest Debian image

  1. Download Debian image [whatever].img.xz

  2. Insert microSD card and make sure that it is unmounted

    • lsblk
    • fdisk -l
  3. Copy the img to the microSD card

    sudo dd bs=4 if=bone-debian-7.8-lxde-4gb-armhf-2015-03-01-4gb.img of=/dev/mmcblk0 conv=fsync

    This step will take a lot of time.

  4. Mount the microSD card and make sure it flashes to the beaglebone:

    sudo mount /dev/mmcblk0p1 /mnt/sd-card
    vim /mnt/sd-card/boot/uEnv.txt

    Uncomment the line:

    cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
  5. Hookup the USB-to-serial cable

    • Connect Black Wire to Pin 1 (closest to 5v barrel)
    • Connect Green Wire to Pin 4 (2 pins from pin 1)
    • Connect White Wire to Pin 5
  6. Connect to USB, check output of dmesg for which /dev/ the serial connection is on

  7. Connect to serial connection via screen

    screen /dev/ttyUSB0 115200
  8. put sdcard in BBB and power up, hold the S2 button, power up

  9. Wait, the status lights will flash in a cylon pattern, you can watch the eMMC flash progress via screen

  10. All User LEDs should be solid on completion

More info is available on the BeagleBoneBlack Wiki

Initial setup

Connect over SSH

To connect via ssh: plugin beaglebone to computer via SSH

ssh -l root 192.168.7.2

Wifi Setup

  1. Plugin the wifi adapter

  2. Reboot (unplug it and plug it back in)

  3. Generate your pre-shared key using wpa_passphrase (see Debian Wiki)

  4. vim /etc/network/interfaces

    auto wlan0
    iface wlan0 inet dhcp
        wpa-ssid "network-name"
        wpa-psk "network-password"
  5. ifdown wlan0; ifup wlan0

  6. use ip -o addr show to confirm that you have an ip address

Update debian

Use the Debian Upgrade Script to update debian:

#!/usr/bin/env bash
# Debian auto-upgrade script
# https://debian-handbook.info/browse/stable/sect.automatic-upgrades.html

# kill all cached creds
sudo -k

# ask for new creds
sudo -v

export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
yes '' | sudo apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

Basic security

Make a root password

  • Install pwgen: sudo apt-get install pwgen
  • Generate a root password: pwgen -Bsy 16 1
  • Store that password in your password store—you'll never remember it
  • Login to beaglebone via ssh, run passwd

Add a privileged non-root user

  • Generate a non-privileged user password: pwgen -Bsy 16 1

  • Save password in password store

  • Add the user

    sudo groupadd sudo-user
    sudo groupadd ssh-user
    useradd tyler
    mkdir /home/tyler
    mkdir /home/tyler/.ssh
    touch /home/tyler/.ssh/authorized_keys
    chown -R tyler:tyler /home/tyler
    chmod 700 /home/tyler/.ssh
    chmod 600 /home/tyler/.ssh/authorized_keys
    usermod -a -G sudo-user tyler
    usermod -a -G ssh-user tyler
    usermod --shell /bin/bash tyler
    passwd tyler
  • give that user sudo privileges

    • EDITOR=vim visudo -f /etc/sudoers.d/sudo-user
    • Add the line: %sudo-user ALL=(ALL) NOPASSWD:ALL
  • Add your laptop's key to user's authorized_keys

    # This should happen from your local machine: laptop/desktop/whatever
    cat ~/.ssh/id_rsa.pub | ssh -l tyler 192.168.7.2 'mkdir -p .ssh && cat >> ~/.ssh/authorized_keys'

Remove demo user

  • userdel -fr debian

Lockdown ssh

  • Generate better hostkeys

    cd /etc/ssh
    rm ssh_host_*key*
    ssh-keygen -t rsa -b 4096 -f ssh_host_rsa_key < /dev/null
  • Modfiy /etc/ssh/sshd_config to make it like below:

    Ciphers aes256-ctr,aes192-ctr,aes128-ctr
    KexAlgorithms diffie-hellman-group-exchange-sha256
    MACs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
    Protocol 2
    HostKey /etc/ssh/ssh_host_rsa_key
    PubkeyAuthentication yes
    PermitRootLogin no
    PasswordAuthentication no
    AllowGroups ssh-user
  • Restart SSH service ssh restart

  • Open a new terminal window and make sure you can still login (you may need to delete and reaccept hostkeys)

Fun Stuff

  • Change ssh banner:

    sudo apt-get install figlet
    awk '$1 !~ /default/' /etc/issue.net > ~/issue.net && sudo mv ~/issue.net /etc/issue.net
    sudo sh -c 'figlet BeagleBone >> /etc/issue.net'
  • BeagleBone pin-out

Things to remember

thank god for 1wire temp sensor blog posts:

License: Creative Commons Attribution-ShareAlike License
neovim on debian
Tyler Cipriani Posted

Installing Neovim

  1. Install Prerequisites

    sudo apt-get -f install libtool libtool-bin autoconf automake cmake g++ pkg-config unzip libmsgpack-dev libuv-dev libluajit-5.1-dev
  2. Clone repo

    git clone https://github.com/neovim/neovim.git
  3. Make install

    cd neovim
    make
    sudo make install

Setup Neovim

ln -s ~/.vim $XDG_CONFIG_HOME/nvim
ln -s ~/.vimrc $XDG_CONFIG_HOME/nvim/init.vim
License: Creative Commons Attribution-ShareAlike License