Unix and Electronics references
Mac
Raspi
Electronics
VI
Onion
ssh -p21098
Mac Stuff
Setting up a local webserver on the mac mac gnu utils ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Then add the following line to your .bashrc or .zshrc: export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH" brew install screen
vnc from mac terminal
open vnc://192.168.60.102:5901
.bash_profile
source ~/.bashrc source ~/.profile
ttl to serial cable
screen /dev/cu.Repleo-PL2303-00002014 115200
.aliases
alias ,='/bin/ls -AC -F -b' alias ,,='/bin/ls -lA -F -b' alias ,,,='/bin/ls -AC1 -F -b' alias ,l='/bin/ls -AC -F -b |less -E' alias ,,l='/bin/ls -Al -F -b |less -E' alias ,,,l='/bin/ls -AC1 -F -b |less -E' alias ..='cd ..' alias e='exit' alias x='startx' alias s='screen -R' alias hg='history |grep'
Raspi Stuff
raspi-config run scripts on startup How To Autorun A Python Script On Boot Using systemd Extra io MCP23017 I2C Port Expander With The Raspberry Pi check for hotspots: sudo iwlist wlan0 scan sudo vi /etc/wpa_supplicant/wpa_supplicant.conf sudo ifdown wlan0 and sudo ifup wlan0 Bring up and down the lan and renew dhcp: sudo ifup wlan0 dhclient -v {interface_name} (renew dhcp) brng network up and down sudo ifdown eth0 && sudo ifup eth0 wifi setup: wpa_gui sudo apt-get install samba samba-common-bin sudo vi /etc/samba/smb.conf workgroup = WORKGROUP sudo service samba restart [pihome] comment= Pi Home path=/home/pi browseable=Yes writeable=Yes only guest=no create mask=0777 directory mask=0777 public=no smbpasswd -a pi sudo reboot apt-cache search ftp gpio -v gpio readall install apache sudo apt-get install apache2 php5 libapache2-mod-php5 -y cd /var/www/html send a file via rsync rsync -av -e 'ssh -p21098' ./localfile robin@lefever.website:~/ w3m wget -r -npH lefever.website/utils/ SSH ssh -l robin lefever.website -p 21098 sudo apt-get install weavedconnectd sudo weavedinstaller sudo apt-get install mlocate sudo updatedb locate / set the time sudo ntpd -q -g sudo apt-get install wavemon ( wifi monitoring ) process manager sudo apt-get install htop ssh keygen ssh-keygen -R server.example.com get ip on pi: ifconfig ssh to pi: ssh -l pi 192.168.60.102 run vnc from pi: sudo apt-get install tightvncserver tightvncserver vnc from mac terminal open vnc://192.168.60.102:5901 to set a root password: sudo su passwd sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get install raspberrypi-ui-mods sudo apt-get install raspberrypi-net-mods sudo chown user:user ~/.Xauthority to send a file from mac to pi over ssh rsync -v -e ssh ./bashaliases.txt pi@192.168.60.102:~/ Shutdown x: Sorry the ctrl-alt-F1, ctrl-C Firmware update: sudo rpi-update alias ,='/bin/ls -AC --color=tty -F -b' alias ,,='/bin/ls -lA --color=tty -F -b' alias ,,,='/bin/ls -AC1 --color=tty -F -b' alias ,l='/bin/ls -AC --color=tty -F -b |less -E' alias ,,l='/bin/ls -Al --color=tty -F -b |less -E' alias ,,,l='/bin/ls -AC1 --color=tty -F -b |less -E' alias ..='cd ..' alias e='exit' alias x='startx' alias s='screen -R' alias hg='history |grep'
Electronics
circuit design
http://fritzing.org/download/ Goto the Top
Unix
head -n 2 < list1 > list2 will read from list1, passing it to head to take the first two lines, then putting these in a file called list2. Add in a pipe: sort < list1 | uniq > list3 export PS1="[$(date +%k:%M:%S)]u@h w> " clear tar zxvf Rpi.GPIO-0.4.1a.tar.gz sudo dd if=~/Downloads/2015-05-05-wheezy-raspbian.img of=/dev/sdb bs=1M Use sudo fdisk -l both before and after plugging in the SD card (you can also use df to see what’s mounted). If, say, a /dev/sdb appears, with the size equal to the SD card, then unmount with umount /dev/sdb1. Now copy the disk image with perl script to replace tabs with spaces perl -pi.old -e 's{t+}{ }g' file.txt
VI things
vi .exrc startup file alt S # splits the screen :resize +3 # increases the size alt tab # switches window set autoindent set noautoindent .vimrc? :set noai followed by :set ai
Onion
5v -> 3.3v 3.3v step down on Amazon SFTP OnionOnion
pagekite.me pagekite.net startup.sh sleep 20 sudo /usr/sbin/screen -d -m /root/pagekite.py oupgrade --latest opkg install screen opkg install python /etc/profile alias ll='ls -alF --color=auto' alias ,='ls -AC -F' alias ,,='ls -lA -F' alias ,,,='ls -AC1 -F' alias ,l='ls -AC -F |less -E' alias ,,l='ls -Al -F |less -E' alias ,,,l='ls -AC1 -F |less -E' alias ..='cd ..' alias e='exit' alias x='startx' alias s='screen -R' alias hg='history |grep' add shell -/bin/ash to /etc/screenrc $ screen -ls $ screen -X -S [session # you want to kill] quit etc/profile add after line 4: ****** IP=$(/sbin/ifconfig apcli0| grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') echo "wlan0 IP: $IP" ********* echo oneshot > /sys/class/leds/omega2p:amber:system/trigger php http://192.168.140.108/php/php_onion/HowToUse.php PHP GPIO Example opkg update opkg install php7 php7-cgi vi /etc/config/uhttpd config uhttpd 'main' list listen_http '0.0.0.0:80' list listen_http '[::]:80' list listen_https '0.0.0.0:443' list listen_https '[::]:443' option redirect_https '1' option home '/www' option rfc1918_filter '1' option max_requests '3' option max_connections '100' option cert '/etc/uhttpd.crt' option key '/etc/uhttpd.key' option cgi_prefix '/cgi-bin' option script_timeout '60' option network_timeout '30' option http_keepalive '20' option tcp_keepalive '1' option ubus_prefix '/ubus' Add this to the last line of that block of text (there is another block of text after this, I've left that out for simplicity) list interpreter ".php=/usr/bin/php-cgi" option index_page 'index.php' Now we need to restart the web server, we do this by running this command: /etc/init.d/uhttpd restart w3m SFTPSFTP To make sftp server work: /etc/opkg/distfeeds.conf We need to remove the two #marks from the line that reads: ## src/gz reboot_packages http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages Articles: Article on using Atom editor and sftp Article on git Article to make traffic light webpage control gpios opkg update opkg install openssh-sftp-server Wifi tools wifi # tries to connect wifimanager -v # tries to connect and diagnose iwinfo # shows wifi networks and strength aps # wireless network scan aps:Security vw:ApCliAuthMode/ApCliEncrypType ========================================================= WPA1PSKWPA2PSK/TKIPAES WPA2PSK/AES WPA2PSK/AES WPA2PSK/AES WPA2PSK/TKIP WPA2PSK/TKIP WPAPSK/TKIPAES WPAPSK/TKIP WPAPSK/AES WPAPSK/AES WPAPSK/TKIP WPAPSK/TKIP WEP WEP/WEP ia #shows network connections