Skip to content

Instantly share code, notes, and snippets.

@simon-lang
Last active September 5, 2017 10:26
Show Gist options
  • Save simon-lang/16efa8ccb73aaf71c799fb771edbc7a7 to your computer and use it in GitHub Desktop.
Save simon-lang/16efa8ccb73aaf71c799fb771edbc7a7 to your computer and use it in GitHub Desktop.
pi.sh
#
# pi
#
# fix timezone
sudo cp /usr/share/zoneinfo/Australia/Brisbane /etc/localtime
# vim
sudo apt-get update
sudo apt-get install vim
# wifi
sudo iwlist wlan0 scan
ifconfig wlan0
sudo vim /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="<my-ssid>"
psk="<my-password>"
}
# hdd usage
df -h
# ssh
install -d -m 700 ~/.ssh
vim ~/.ssh/authorized_keys
ssh-add
# motion
sudo apt-get install motion
sudo vim /etc/motion/motion.conf
sudo vim /etc/default/motion
tail -f /tmp/motion.log
sudo chmod 777 /var/lib/motion/
sudo service motion start
sudo service motion stop
sudo service motion status
sudo service motion restart
# change motion config items
logfile /tmp/motion.log
width 640
height 480
framerate 30
output_pictures off
target_dir /var/lib/motion
stream_quality 75
stream_motion on
stream_maxrate off
webcontrol_localhost off
# aliases
alias cleanimages="rm -f /var/lib/motion/*.jpg"
alias cleanall="rm -f /var/lib/motion/*"
alias stopmotion="sudo service motion stop"
alias startmotion="sudo service motion start"
alias restartmotion="sudo service motion restart"
alias logmotion="tail -f /tmp/motion.log"
alias motionconf="sudo vim /etc/motion/motion.conf"
#
# local
#
# nmap on local to discover pi address
brew install nmap
nmap -sn 192.168.0.0/24 | grep "192"
# aliases
alias pi="[email protected]"
alias downloadmovies="scp [email protected]:/var/lib/motion/*.avi ~/motion/"
alias download-timelapses="scp [email protected]:/var/lib/motion/*.mpg ~/motion/"
# install mencoder for joining videos
brew install mplayer
cp /usr/local/Cellar/mplayer/1.3.0/bin/mencoder /usr/local/bin/
# join videos and fix header
cd ~/motion
cat *-*.avi > ~/motion/output.avi
mencoder -forceidx -oac copy -ovc copy ~/motion/output.avi -o ~/motion/output_final.avi;
rm ~/motion/output.avi
rm ~/motion/*-*.avi
mv output_final.avi joined/$(date +%Y-%m-%d).avi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment