Skip to content

Instantly share code, notes, and snippets.

View krazybean's full-sized avatar
😶‍🌫️
Fumbling

Juan Castro krazybean

😶‍🌫️
Fumbling
View GitHub Profile
@dnmellen
dnmellen / timeout_decorator.py
Created January 23, 2014 15:39
Threaded timeout Python decorator
import threading
import logging
from functools import wraps
logger = logging.getLogger(__name__)
def timeout(secs=None):
def my_decorator(target, *args, **kwargs):
@lukaszb
lukaszb / notify.py
Created February 21, 2013 01:23
Simple Python script to send notification to the OSX Notifications Center (requires OS X 10.8+). Tested with pyobjc 2.5.1
#!/usr/bin/env python
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
from optparse import OptionParser
def main():
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE')
@codebullies
codebullies / README.md
Last active August 11, 2021 03:36
An example of CZMQ Multicast using PUB/SUB

To use the scheme epgm:// or pgm:// you must configure libzmq 3.x (HEAD) using the --with-pgm.

./configure --with-pgm
./make
./make install

Remember to set you LD_LIBRARY_PATH to the location of the libzmq installation parameter For bash:

export LD_LIBRARY_PATH=/usr/local/lib

@luque
luque / install.sh
Created October 26, 2012 09:29 — forked from clemherreman/install.sh
How to: install Hubot on Debian Squeeze
# 1. Install nodejs and npm:
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev python
git clone https://github.com/joyent/node.git
cd node
# 'git tag' shows all available versions: select the latest stable.
git checkout v0.9.3
@turicas
turicas / attrdict.py
Created December 22, 2011 16:21
Python class with dict-like get/set item
#!/usr/bin/env python
# coding: utf-8
class AttrDict(object):
def __init__(self, init=None):
if init is not None:
self.__dict__.update(init)
def __getitem__(self, key):
return self.__dict__[key]
@cowboy
cowboy / github_post_recieve.php
Created October 11, 2010 02:04
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi