Skip to content

Instantly share code, notes, and snippets.

<?php
function getReplicationInfo($m) {
$db = $m->local;
$result = array();
$ol = $db->system->namespaces->findOne(array("name" => 'local.oplog.$main'));
if ($ol && array_key_exists('options', $ol)) {
$result['logSizeMB'] = $ol['options']['size'] / 1000 / 1000;
@dolinsky
dolinsky / desopa
Created January 18, 2012 15:41
A bookmarklet that 'desopafies' Wikipedia pages. Please only use this after you've contacted every single one of your representatives to let them know how harmful SOPA and PIPA really are.
javascript:(function(){var d=document.getElementById("mw-sopaOverlay");d.setAttribute("style","display: none");var a=["mw-page-base","mw-head","mw-panel","mw-head-base","content","footer"];for(var i=0;i<a.length;i++){var d=document.getElementById(a[i]);d.setAttribute("style","display: block")}})();
# Print summary of hostnames mongod has open connections to
sudo lsof | grep TCP | grep mongod | awk '
BEGIN {}
{
split($9,p,":");
conn = p[1] p[2];
conns[conn]++;
}
END { for (c in conns) {
printf "%s\t%d\n", c, conns[c]
@dolinsky
dolinsky / _readme.md
Last active December 20, 2015 10:09 — forked from shime/_readme.md

Having trouble installing the latest stable version of tmux?

Save yourself some time and run this little fellow!

Prerequisities

  • gcc
  • wget
@dolinsky
dolinsky / runsandman.py
Created February 20, 2014 22:22
Custom JSONEncoder to handle date() encoding in Flask
#!/usr/bin/env python
from sandman import app
from flask.json import JSONEncoder
class CustomJSONEncoder(JSONEncoder):
def default(self, obj):
try:
if isinstance(obj, date):
return obj.isoformat()

Keybase proof

I hereby claim:

  • I am dolinsky on github.
  • I am davidolinsky (https://keybase.io/davidolinsky) on keybase.
  • I have a public key ASBFkMq5iZR99b3mFI63Yt1CphWCwpPiv1v6l5aXjPSRXwo

To claim this, I am signing this object: