Skip to content

Instantly share code, notes, and snippets.

View lourenci's full-sized avatar
🏠
Working from home

Leandro Lourenci lourenci

🏠
Working from home
View GitHub Profile

First-steps to boot

  • Burn the Raspbian lite image on Raspberry's SSD.

  • On mount partition, put a blank ssh file on it. Raspberry doesn't enable SSH server by default.

  • Connect to Raspberry through SSH.

    | User | Password | |:-:|:-:|

@lourenci
lourenci / useful-vim-tips.md
Last active October 29, 2019 14:36
Useful vim tips

Execute a command in every line matching the pattern

:g/pattern/normal command

Examples:
  • Execute a macro store in @a in every line starting with //: :g/\/\//normal @a

  • Delete every line starting with //: :g/\/\//normal dd

@lourenci
lourenci / useful-git-commands.md
Last active December 20, 2018 16:57
Useful git commands

File "cherry-pick"

git checkout [source-branch] [file]

Show the file content of a specific branch

git show [branch]:[file]

@lourenci
lourenci / install-pg-gem-without-pg.md
Last active July 3, 2018 18:47
Install pg gem without Postgres
  • Install the client lib for Postgres: brew install libpq

  • Install the gems

  • Remove the libpq

@lourenci
lourenci / commands.md
Last active October 16, 2017 16:02
Cleaning docker
  • Remove containers left by run command without --rm flag:
$ docker rm $(docker ps -a --filter "status=created" --filter "status=exited" | egrep 'run_[0-9]+$' | awk '{print $1}')
  • Remove dangling images:
$ docker rmi $(docker images -q --filter "dangling=true")
@lourenci
lourenci / commands.md
Last active June 28, 2019 13:32
Postgres bin dump and restore

Dump

pg_dump -Fc database -U user > file

Restore

pg_restore -Fc -d database -U user -O file