Skip to content

Instantly share code, notes, and snippets.

@mirskiy
Last active November 17, 2016 16:20
Show Gist options
  • Save mirskiy/be36dc4c60a9250b522f to your computer and use it in GitHub Desktop.
Save mirskiy/be36dc4c60a9250b522f to your computer and use it in GitHub Desktop.
commanding lines
## history
# Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to ``!!:s/string1/string2/'' (see Modifiers below).
^string1^string2^
# Swap usage
vmstat
# display in hex
echo 'test' | hd
# battery info
cat /sys/class/power_supply/BAT1/capacity
cat /sys/class/power_supply/BAT1/energy_now /sys/class/power_supply/BAT1/energy_full
# mongo
db.getCollection('processedpdfs').find({$text: {$search: 'pfg'}}).sort({'_id': -1})
# postgres
pg_restore backupfile | grep olduser | grep ALTER | sed 's/olduser/newuser/' | psql --dbname dbname
# Env vars from .env
while read line; do [[ $line != \#* ]] && [[ $line ]] && echo $line | sed 's/=/="/' | sed 's/$/"/' ; done < <(cat .env) > .env.exported
heroku addons:open bonsai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment