more notes from the past few months:
shell notes
use cmd+i to set the ‘badge’ to something useful
exit all ssh sessions
~.
vi
vi find
/string Search forward for string
?string Search back for string
n Search for next instance of string
N Search for previous instance of string
vi delete all lines
:1,$d
src
vi line moving
Therefore, dd p / dd k P are common commands to move a line one down / up.
yy
to yankp
to paste afterP
to paste beforeu
to undo
comment out in vim
ctrl+v to enter visual block
x to delete selection
shift+I to enter edit mode on multiple lines
misc
:w [filename]
curl proxy
-x, –proxy [protocol://][user:password@]proxyhost[:port]
find (and kill) that process
ps -A | less
ps -A | grep firefox
ps -feww | grep firefox
kill 31098
kill -15 (SIGTERM) 31098
webstorm
minimap
CodeGlance plug in
scratch page
shift + command + n
search everywhere
shift + shift + shift
aut0-format⌥+⌘+L
option + command + L
cd back
cd -
protobuf
If you are running into an error with node-gyp regarding protobuf when running npm install:brew install protobuf
brew install pkg-config
send output to file and console
tee
it up!
color output
console.log('\x1b[36m%s\x1b[0m', 'I am cyan');
https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color
mongo
db.collection.find().limit(1).sort({$natural:-1})
.pretty()
on json payloads to make them…pretty..explain('executionStats')
{$regex : ".*/route$"}
case insensitive
db.stuff.find( { foo: /^bar$/i } )
https://stackoverflow.com/questions/1863399/mongodb-is-it-possible-to-make-a-case-insensitive-query
kill mongo stuffs
db.currentOp()
db.currentOp( { "$ownOps": true } )
- only your own ops?db.killOp([the_opid])
db.currentOp().inprog.length
and or
$and: [{expression 1}, {expression 2}]
$or: [{expression 1}, {expression 2}]
|
|
Max query time:.maxTimeMS()
remove env vars
unset <var>
grep
multiplesgrep -e foo -e bar *.txt
extra spaces
-A after
-B before
-C both
srchttps://unix.stackexchange.com/questions/37313/how-do-i-grep-for-multiple-patterns)
pm2
watch
–watch [paths]
–ignore-watch
note: need to figure out how to correctly pass in ignored files
using config file is easier
node args
“node_args”: “–prof”
iterm
jump words
https://coderwall.com/p/h6yfda/use-and-to-jump-forwards-backwards-words-in-iterm-2-on-os-x
config open location
command overlord
command + shift + i = send command to all terminal windows
finding where something is aliased
which ls
ls: aliased to ls -G
grep -r 'ls -G' ~
src (2nd answer down)
to overridecommand ls
ping to get ip of url
windows ssh
eval ssh-agent -s
ssh-add -l
ssh-add .ssh/your_id #not the pub one