Skip to content

Commands Cheatsheet

Antonio Vivace edited this page Feb 26, 2019 · 7 revisions

Some useful practices and commands used during development.

  • After having merged a branch, to continue working on that branch, syncing with master:
# Checkout the default branch (master or develop)
git checkout master
git pull
# Delete the local branch
git branch -D nomeBranch
# Delete remotely
git push origin --delete nomeBranch
# Recreate it locally
git branch -m 'nomeBranch'
# During the first push, specify the branch to remotely track
git push --set-upstream origin nomeBranch
  • Save the pi ip and ssh login informations in .ssh/config
Host pi
  Hostname x.x.x.x
  User pi
  IdentityFile ~/.ssh/id_ed25519
  • Use an SSH key (without password or with password saved by an ssh-agent) to automatically ssh to rpi (ssh pi)
  • Development/Editing files on the instance deployed on Raspberry (alternatives):
    • Rsync over ssh on each change and work locally (setup your editor to do this on each change). Do git things locally. rsync -rtv cb/coderbot/ pi@pi:/home/pi/coderbot
    • Mount with sshfs sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa root@xxx.xxx.xxx.xxx:/ /mnt/droplet (on LAN works well)
    • Edit there with vim
    • commit/pull each change on a draft branch
  • Send a POST request passing a payload JSON curl -d @payload.json -H "Content-Type: application/json" PAYLOAD/URL/SOME/POST, or a JSON string curl -d '{'a' : 1}' -H "Content-Type: application/json" PAYLOAD/URL/SOME/POST

dd sometimes bugs out, sudo rm /dev/sdb and reinsert the microsd and let the system recreate the file, then rerun dd

Clone this wiki locally