notes from the past few months:
Terminal Copy
copy and paste pwd form command line:pwd | pbcopy
–> to copy current directory to clipboard
then cd $(pbpaste)
–> to cd in different terminal
Copying when sshed in
commandThatMakesOutput | ssh (host name) pbcopy
need local ssh server though…
scroll up in terminal:
shit + fn up-key (page up)
webstorm
command 1 = project view
command 2 = favorites
command 3 = search thingy
esc = return to editor
Mongo - ‘the mongo shell speaks js’
decodeURIComponent(query that returns stringified stuff)
npm test
exit status 0 is added to the end of npm test calls
Use ; exit 0
to replicate this for other npm scripts.
source of info and link to code source
grep
files with regex
grep -c -F /\**
grep ^\ *function
grep options
-c count
-F fixed string
control-R to search command history!!
Broken Git Fetch?
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
Running in background
node server.js > std.txt 2> err.txt &
Time stamp in name
$(date +%s)
What does /etc stand for?
http://www.aboutlinux.info/2007/03/what-does-etc-stands-for-in-linuxunix.html
JSON Funzies
json_pp
jq
- jq 'if ._links.html then ._links.html.href else .errors[0].message end'
Shhh curl, shhh
-s
flag prevents process display
PM2
delete - start with a set environment variablespm2 delete 0
pm2 start app.json --only num2
clean logspm2 logs [--raw] 0
SSH
ssh-copy-id [username]@[addresss]
NPM
npm i -S
-> save as dep - this is now the default behavior in npm@5npm i -D
-> save as dev depnpm repo
-> go to reponpm run
-> what can i run?
npm version [<newversion> | major | minor | patch ]
npm ls -g --depth=0
npm uninstall -g
list and uninstall globals
npm update -g
update globals - not sure if this is recommended
npm rb
rebuild after changing node version
git reset
git reset HEAD~
good ref for other things:
http://ohshitgit.com
vi
set number
:44
syntax off
x - to delete char under cursor
pasting:set paste
then i
then :set nopaste
src
docker port publishing
docker run -d -p 127.0.0.1:80:8080 ubuntu bash
This binds port 8080 of the container to port 80 on 127.0.0.1 of the host machine.
A.k.a -p [host]:[container]
. host:container, host:container got it.