Skip to content

Instantly share code, notes, and snippets.

View mrtrom's full-sized avatar
:shipit:

Alexander Ochoa mrtrom

:shipit:
  • Here
View GitHub Profile
@mrtrom
mrtrom / prettyjson.sh
Created May 26, 2016 23:52
Pretty JSON
$ alias prettyjson='python -m json.tool'
$ prettyjson my-json-horrible-file.json
@mrtrom
mrtrom / crontab.sh
Created May 26, 2016 23:50
Storing crontab output
*/10 * * * * /bin/execute/this/script.sh >> /var/log/script_output.log 2>&1
# More information on: http://kvz.io/blog/2007/07/29/schedule-tasks-on-linux-using-crontab/
# Crontab generator http://crontab-generator.org/
@mrtrom
mrtrom / apt.sh
Last active May 26, 2016 20:57
List all installed packages
# general view
dpkg --get-selections | grep -v deinstall
# detailed view
dpkg -l
@mrtrom
mrtrom / mongo.sh
Created May 25, 2016 22:44
Initialize and shutdown mongod
# If using Homebrew
brew services start mongodb #start service
brew services list #list services to see if it's running
brew services stop mongodb #stop service
# If starting manually
mongod --fork --logpath /usr/local/var/log/mongodb/mongo.log # start service [logpath located in mongod.conf]
mongod --shutdown # stop service on linux
mongo admin #stop service osx/other
db.shutdownServer()
@mrtrom
mrtrom / port.sh
Created May 25, 2016 21:41
Tell if a port is in use
lsof -n -i4TCP:[PORT] | grep LISTEN
# lsof -n -i4TCP:27017 | grep LISTEN
@mrtrom
mrtrom / binary
Created May 25, 2016 21:34 — forked from elhoyos/binary
mongo: Copy a collection
$ mongodump -d some_database -c some_collection
$ mongorestore -d some_other_db -c some_or_other_collection dump/some_collection.bson
@mrtrom
mrtrom / time.sh
Created May 25, 2016 21:30
Measures web site’s response time
time wget http://www.aip.im -q --output-document=/dev/null
# See more at: http://www.aip.im/2012/05/how-to-measure-web-sites-response-time-with-wget/#sthash.EI6QgjGQ.dpuf