Skip to content

Instantly share code, notes, and snippets.

@mhl
mhl / meld-compare-refs.py
Created July 29, 2010 16:46
Extract the trees from two commits to a temporary directory and run meld on them
#!/usr/bin/python3.1
# This is script that extracts the trees of two commits to temporary
# directories and then runs meld on both directories, so you can compare
# them using meld's nice recursive browsing interface.
#
# This is for an answer to this question:
# http://stackoverflow.com/questions/2006032/view-differences-of-branches-with-meld
from subprocess import call, Popen, PIPE, check_call
from flask import Flask, request
from gevent.event import AsyncResult
from gevent.wsgi import WSGIServer
app = Flask(__name__)
waiters = []
@app.route("/")
def main():
@bdarnell
bdarnell / fdserver.py
Created July 9, 2011 20:41
Demonstration of sharing file descriptors across processes
#!/usr/bin/env python
"""This is a demonstration of sharing file descriptors across processes.
It uses Tornado (need a recent post-2.0 version from github) and the
multiprocessing module (from python 2.6+). To run it, start one copy
of fdserver.py and one or more copies of testserver.py (in different
terminals, or backgrounded, etc). Fetch http://localhost:8000 and
you'll see the requests getting answered by different processes (it's
normal for several requests to go to the same process under light
load, but under heavier load it tends to even out).
@kgaughan
kgaughan / gist:1835224
Created February 15, 2012 11:40
Getting the domains assigned to a bunch of domains from DNS
from dns.resolver import Resolver, query, NXDOMAIN
import dns.query
from dns.exception import Timeout
from dns.message import make_query
from dns.rdatatype import NS
import socket
from random import choice
def get_zone_nameservers(zone):
nss = []
@peplin
peplin / gist:2483204
Created April 24, 2012 20:05 — forked from agriffis/gist:2481292
.bashrc.virtualenvwrapper
# Dynamically load virtualenvwrapper functions to reduce shell startup
# time.
#
# Copyright 2012 Aron Griffis <aron@arongriffis.com>
# Released under the GNU GPL v3
#######################################################################
# Python virtualenvwrapper loads really slowly, so load it on demand.
if [[ $(type -w workon) != "workon: function" ]]; then
virtualenv_funcs=( workon deactivate mkvirtualenv )
@dlo
dlo / .vimrc
Created June 28, 2012 15:53
Relative Line Numbers in Vim
set rnu
au BufEnter * :set rnu
au BufLeave * :set nu
au WinEnter * :set rnu
au WinLeave * :set nu
au InsertEnter * :set nu
au InsertLeave * :set rnu
au FocusLost * :set nu
au FocusGained * :set rnu
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@mattratleph
mattratleph / vimdiff.md
Last active May 9, 2024 03:11 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@malonem
malonem / find-dead-executors.groovy
Created February 27, 2013 05:30
Jenkins script to find dead executors and remove them.
// get handle to build output
def config = new HashMap()
def bindings = getBinding()
config.putAll(bindings.getVariables())
def out = config['out']
for (aSlave in hudson.model.Hudson.instance.slaves) {
// check if executor is dead
execList = aSlave.getComputer().getExecutors()
for( exec in execList ) {