This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
import signal | |
import gevent | |
import gevent.pool | |
from rq import Worker | |
from rq.timeouts import BaseDeathPenalty, JobTimeoutException | |
from rq.worker import StopRequested, green, blue | |
from rq.exceptions import DequeueTimeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from time import time, sleep | |
import uuid | |
class RedisSemaphore(object): | |
""" | |
Redis base semaphore. Supports timeouts of semaphore locks. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sleep(secs): | |
d = Deferred() | |
reactor.callLater(secs, d.callback, None) | |
return d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git prompt | |
export GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWUNTRACKEDFILES=1 GIT_PS1_SHOWSTASHSTATE=1 | |
export PS1='\w\[\033[01;33m\]$(__git_ps1)\[\033[00m\] \$ ' | |
# less syntax highlighting | |
# brew install source-highlight | |
export LESSOPEN="| src-hilite-lesspipe.sh %s" | |
export LESS=' -R ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////// | |
// JAVASCRIPT RULE ENGINE | |
/////////////////////////// | |
/*global define*/ | |
define([ | |
'lodash.noconflict' | |
], function (_) { | |
'use strict'; | |
function Rules(options) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.find "!gf() { git log -G \"\$1\" --pretty=\"format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\" --abbrev-commit --date=relative; }; gf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://mojodna.net/2009/08/21/exploring-oauth-protected-apis.html | |
easy_install oauth-proxy | |
sudo gem install oauth | |
oauth --consumer-key XXXXX --consumer-secret XXXXX --access-token-url http://springpadit.com/api/oauth-access-token --authorize-url http://springpadit.com/api/oauth-authorize --request-token-url http://springpadit.com/api/oauth-request-token authorize | |
oauth-proxy --consumer-key XXXXX --consumer-secret XXXXX -p 8001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { font: normal x-small verdana !important; } | |
.link { margin-bottom: 4px !important; } | |
.link .title { font: normal 10pt verdana !important; } | |
.link .flat-list { padding: 0px !important; } | |
.tagline { font: normal 7pt verdana !important; display:none !important; } | |
.link .rank { display: none; } | |
.sitetable { padding: 10px !important; margin-top: 30px !important; margin-left: 100px !important; margin-right: 100px !important; background-color: #F6F6EF } | |
.side { display: none; } | |
a:link { color: black !important; text-decoration: none !important;} | |
a:visited {color: #828282 !important;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reject traffic out to a specific IP | |
iptables -o eth0 -I OUTPUT -d 10.207.47.148 -j REJECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def time_method(stat_name): | |
""" | |
Attaches a timeout to the deferred returned by the wrapped function. | |
After timeout seconds the deferred is canceled and an exception raised. | |
""" | |
def attach_timing(method): | |
@functools.wraps(method) | |
def wrapper(self, *args, **kwargs): | |
start = time() |
NewerOlder