09 January 2017

ALSA Pi

#!/bin/bash

arecord -D hw:1,0 -f S16_LE -r 16000 -t raw audio-S16LE-16K-`date +%G%m%d-%H%M%S`.raw
aplay -f S16_LE -r 16000 -t raw *.raw
killall arecord

screen

screen is an essential command line utility to run commands remotely over SSH without persistent connections. Shell wildcards and I/O redirections require to feed the command to the shell interpreter as arguments for screen.

# On OS X
brew install screen
# Create a new named session to execute a command in detached mode with bash I/O redirection
screen -S monsoon -m -d sh -c 'monsoon.py --samples -1 --hz 200 --serialno 6325 > "path/to/file"'
# Send ctrl+C or QUIT to kill a previous named session
sudo screen -S monsoon -X at "#" stuff $'\003'
sudo -S -p '' screen -S monsoon -X quit

Ubuntu

Install grub under btrfs

  1. try and install ubuntu by default

  2. install grub manually if failed

for i in dev dev/pts sys proc run; do sudo mount --bind /$i /target/$i; done
sudo chroot /target
grub-install /dev/sda
update-grub
exit

Locale

sudo locale-gen en_US.UTF-8

SSH

RSA Public Key Auth

# generate local public key
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa

# copy to the remote host
brew install ssh-copy-id
ssh-copy-id -p 2222 farleylai@alacran.cs.uiowa.edu

SSHFS

# install
sudo apt-get install sshfs

# /etc/fuse.conf
user_allow_other

# mount a remote directory
sudo sshfs -o idmap=user -o allow_other farleylai@alacran.cs.uiowa.edu:Documents/dev ~/Documents/alacran

# umount
sudo fusermount -u ~/far_projects

# /etc/fstab
sshfs#farleylai@alacran.cs.uiowa.edu:Documents/dev ~/Documents/alacran fuse defaults,idmap=user,allow_other 0 0