notes

kill mongo stuffs

db.currentOp()
db.currentOp( { "$ownOps": true } ) - only your own ops?
db.killOp([the_opid])

curl time

-w %{time_connect}:%{time_starttransfer}:%{time_total}
-w '\ntime_connect: %{time_connect} time_starttransfer: %{time_starttransfer} time_total: %{time_total} size_download: %{size_download}\n'

curl follow 302

curl -b cookies.txt with -L or --location-trusted
This will retain the cookies from the redirect and send them back on the GET

nodemon --exec for compiling and/or linting

nodemon --exec 'javac SomeClass.java && java SomeClass' ./SomeClass

jq

jq '.data.key.term.otherKey'
https://github.com/stedolan/jq/

create mongo time stamp from 1hr ago in bash

printf 'ObjectId("%x0000000000000000")\n' $(date -v-60M -u +%s)

bash time stamp

SECONDS=0
do some work
duration=$SECONDS
echo "$(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."

node memory testing

kill -s SIGUSR1 node_pid

https://codefresh.io/blog/debug_node_in_docker/

git

looking at tags

git describe --tags

set the author

git commit --author="John Doe <john@doe.com>" -m "<the usual commit message>"
src

cleaning up branches

git branch -d [name] - to delete
git branch --merged - to see whats been merged

1
2
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do echo $branch; done # to see what will be deleted
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -d $branch; done # to delete

git diff

filter new files:
git diff origin/base origin/head --diff-filter=M

find and replace

osx:
find . -type f -name '*.csv' -exec sed -i '' "s/find/replace/g" {} \;
linux:
find . -type f -name '*.csv' -exec sed -i "s/{find}/{replace}/g" {} \;

push pop dirs

pushd
popd
dirs -l #list

look at docker logs command

docker logs