Skip to content

Instantly share code, notes, and snippets.

View dialtone's full-sized avatar

Valentino Volonghi dialtone

View GitHub Profile
def funpath(fun):
return ".".join([fun.__module__, fun.__name__])
def getm(fun):
return namedAny(funpath(fun))
class LockMap(object):
"""
The LockMap object doesn't really have any active part in
the execution of tasks. It is however useful for the user
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940887] INFO: task jsvc:4846 blocked for more than 120 seconds.
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940902] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940910] jsvc D ffff8803bffa3b00 0 4846 4831 0x00000000
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940916] ffff88039e535e68 0000000000000286 ffff88039e535fd8 ffff88039e534000
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940922] 0000000000013b00 ffff8803a0e247e0 ffff88039e535fd8 0000000000013b00
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940928] ffff8803a12d5b00 ffff8803a0e24440 0000000000000246 ffff8803a0e24440
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940934] Call Trace:
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940948] [<ffffffff815dbddd>] rwsem_down_failed_common+0xcd/0x170
Jun 13 23:00:51 ip-10-169-65-173 kernel: [6391575.940955] [<ffffffff8100779d>] ? xen_fo
#!/usr/bin/env python
import os
import shutil
import socket
from optparse import OptionParser
from boto import ec2
BASE = """
#!/usr/bin/env python
import os
import urllib
import boto
from boto import ec2
def get_seeds(conn, cluster):
all_instances = conn.get_all_instances(filters={"tag:type": "*", "tag:cluster": cluster})
seeds = []
for reservation in all_instances:
#!/bin/bash
TMPDIR=
TMPFILE=
TMPDIR=`mktemp -t tmp/adroll -d`
TMPFILE=`mktemp -t adroll`
git diff --cached --name-only --diff-filter=ACMR | xargs git checkout-index --prefix=$TMPDIR/ --
pyflakes $TMPDIR >$TMPFILE 2>&1
grep -v "unable to detect undefined names" $TMPFILE >$TMPFILE.2
sed "s/^${TMPDIR//\//.}.//" $TMPFILE.2 >$TMPFILE
egrep -v "migrations.*'(datetime|models)' imported but unused" $TMPFILE >$TMPFILE.2
@dialtone
dialtone / pivotal_to_github.py
Created September 23, 2011 00:48
Migrate from Pivotal Tracker to GitHub issues
import re
import sys
import csv
import json
import urllib2
from datetime import datetime
from collections import defaultdict as dd
@dialtone
dialtone / gist:1366277
Created November 15, 2011 05:47
Loop fprof result
Processing data...
Creating output...
%% Analysis results:
{ analysis_options,
[{callers, true},
{sort, acc},
{totals, false},
{details, true}]}.
% CNT ACC OWN
<!DOCTYPE html>
<!--
* Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this
* source code is governed by a BSD-style license that can be found in the
* LICENSE file.
-->
<html>
<head>
</head>
<body>
putitem(Key, AdGroupId, AdId, ?IMP, TTL, Now) ->
dinerl:put_item(<<"Attributions">>, [{<<"UserKey">>, [{<<"S">>, Key}]},
{<<"Updated">>, [{<<"N">>, list_to_binary(integer_to_list(Now))}]},
{<<"TTL">>, [{<<"N">>, list_to_binary(integer_to_list(TTL))}]},
{<<"AdGroupId">>, [{<<"S">>, AdGroupId}]}, {<<"AdId">>, [{<<"S">>,
AdId}]}, {<<"Kind">>, [{<<"S">>, ?IMP}]}], []).
@dialtone
dialtone / projectRoot.vim
Created January 24, 2012 06:49
Find root of a project given some markers
function! s:findroot(curr, markers, depth)
" Search all markers in the current directory
for marker in a:markers
let found = !empty(globpath(a:curr, marker))
if !found && a:depth > 40
return ''
endif
if found
return a:curr
endif