Skip to content

Instantly share code, notes, and snippets.

View imlucas's full-sized avatar
⚒️

Lucas Hrabovsky imlucas

⚒️
  • CNN
  • Philadelphia, PA
View GitHub Profile

Sublime Text + MongoDB

Debugging Source

  1. Install Sublime GDB
  2. Create a new sublime-project file using mongodb_source-seed-sublime_project.json
  3. Dance

Running Scripts

guz ui graphs && cd graphs && npm install --save d3 lodash debug && echo "console.log('hiya', require(lodash));" > index.js && echo '<html><body><h1>word</h1><script src="index.js"></script></body></html>' > index.html && npm start
> graphs@0.0.1 start /Users/lucas/graphs
> gulp dev
in guzzle
[gulp] Using gulpfile /Users/lucas/graphs/gulpfile.js
[gulp] Starting 'js'...
[gulp] Finished 'js' after 7.15 ms
[gulp] Starting 'cp'...

collection: 02

3 modes of engagement for the UI to respond to:

  • browse: "oh hey what's this thing": 8x4
  • poke: "how many many users are we at now": 10x2
  • dig: "what's that annoying dutch guy's email again": 12x0
// There are various modes that Node can run in. The most common two
// are running from a script and running the REPL - but there are a few
// others like the debugger or running --eval arguments. Here we decide
// which mode we run in.
if (NativeModule.exists('_third_party_main')) {
// To allow people to extend Node in different ways, this hook allows
// one to drop a file lib/_third_party_main.js into the build
// directory which will be executed instead of Node's normal loading.
process.nextTick(function() {
@imlucas
imlucas / gist:9977476
Last active August 29, 2015 13:58
http://www.sysdig.org/: strace + tcpdump + lsof + sugar
# Print process name and connection details for each incoming connection not served by mongod.
sysdig -p "%proc.name %fd.name evt.type=accept and proc.name!=mongod"
# See the files where mongodb spends the most time doing I/O.
sysdig -c topfiles_time proc.name=mongod
# Show the network data that mongodb exchanged with 192.168.0.1.
sysdig -A -c echo_fds fd.sip=192.168.0.1 and proc.name=mongod
# Show every time a file is opened under /data/mongodb.
@imlucas
imlucas / mongoscope_source.sh
Last active August 29, 2015 13:58
run mongoscope from source
git clone git@github.com:10gen/mongoscope.git mgs;
cd mgs;
npm install;
DEBUG=mongo* bin/mongoscope.js;
@imlucas
imlucas / mongoscope_dist.sh
Last active August 29, 2015 13:58
build a binary from mongoscope source
git clone git@github.com:10gen/mongoscope.git mgs;
cd mgs;
npm install;
npm run-script dist;
git clone git@github.com:imlucas/wikipedia-edit-stream ~/;
cd ~/wikipedia-edit-stream && npm install;
DEBUG=* node example.js;
open http://localhost:29017/#database/dataset-wikipedia;

why

hmmm
- python on centos hell - sysadmins can (rightly so! love you!) be jerks. - "But we'll use chef!" "but you can't have sudo, tho." - write a little script for your mom that automatically copies photos from the desktop folder, which is the only place she knows where to put them to get the off the camera, to the dropbox folder you set up for her but she has no idea how to use and instead of the next time the hard drive goes on the best buy special you can just skip all of

Lucass-MacBook-Air.local sharding report

collections

test.users

  • shard on {"_id":1}
  • tags none
  • storage 8kb, documents 96b, indexes 8kb
  • documents 2