Skip to content

Instantly share code, notes, and snippets.

View zol's full-sized avatar

Zoltan Olah zol

View GitHub Profile
@zol
zol / mongo-setup.md
Last active January 22, 2016 22:20
Setting up mongodb with oplog tailing

Setting up replicaset

  • Log into mongodb1
  • Configure the replicaset (with a secondary and arbiter)
rs.initiate()
rs.add('ip-internal-ip-of-mongodb2')
rs.addArb('ip-internal-ip-of-mongodb3')
@zol
zol / gcontrol.sh
Last active August 29, 2015 14:06
Ground Control CLI
#!/usr/bin/env bash
#
# Ground Control CLI
# Copyright Percolate Studio 2014
if [ $# -gt 0 ]; then
ssh -t -x $1@build.gcontrol.io gcontrol ${*:2}
else
echo "Ground Control CLI"
echo "Usage: gcontrol.sh <app> [command] [arguments]"
@zol
zol / gist:2dadb04add98bc8c3219
Created June 25, 2014 18:30
Redirect all output and background command
some_cmd > some_file 2>&1 &
@zol
zol / gist:16710210c9f7569a7050
Last active August 29, 2015 14:01
Tunnel remote port to localhost
ssh -L 9000:localhost:8983 ubuntu@host
# forwards remote port 8993 to local port of localhost:9000 as seen by host
@zol
zol / gist:62c772d94d33581b9ab6
Created May 2, 2014 19:29
Remove branches from origin that have been merged into master except devel
git fetch
git checkout master
git branch --merged | grep -v "\*" | grep -v devel | xargs -n 1 git push --delete origin
# this last step is for colleagues to clean up their local tracking branches
git remote prune origin
@zol
zol / watch-mongodb-oplog.js
Last active August 29, 2015 13:56
Tailing the mongodb oplog
#!/usr/bin/env node
MongoWatch = require('mongo-watch');
new MongoWatch({
format: 'pretty',
db: 'XXX',
host: 'XXX'
}).watch();
@zol
zol / gist:8905602
Created February 9, 2014 20:38
Copy directory tree excluding .git directories
rsync -av --exclude='.git*' src dest
@zol
zol / gist:8428649
Created January 15, 2014 00:26
Connecting to a running meteor development app's mongodb oplog from a second app launched on port 3100
MONGO_OPLOG_URL=mongodb://127.0.0.1:3002/local MONGO_URL=mongodb://127.0.0.1:3002/meteor meteor --port 3100
@zol
zol / gist:6643666
Created September 20, 2013 20:45
Restore a dumped mongodb into local meteor development db
mongorestore --port 3002 --drop --db meteor ./dump/verso/
@zol
zol / gist:6440391
Created September 4, 2013 17:53
Debugging a meteor app with node inspector.
Client-side you have the console. For server-side debugging, use node-inspector and make sure you have meteor v0.5.3, which makes things easier thanks to support for NODE_OPTIONS:
Install node-inspector: `npm install -g node-inspector`
Start meteor: `NODE_OPTIONS='--debug' mrt run`
Start `node-inspector`
Go to the URL given by node-inspector in Chrome
Debug at will