Skip to content

Instantly share code, notes, and snippets.

# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts
server {
listen 80 default;
server_name domain.com;
import zmq
import threading
import uuid
import time
import itertools
from homingbird import Node, LocalNode
def get_random():
return str(uuid.uuid4()).replace('-','')
@jself
jself / repos.py
Created March 26, 2012 20:50
git multi repos processor
#!/usr/bin/env python
from pbs import git, cd, pwd
from cmd2 import Cmd
class GitPrompt(Cmd):
def __init__(self, *args, **kwargs):
Cmd.__init__(self, *args, **kwargs)
self.base_dir = '/home/jself/devel/cms_dev/src/'
self.repos = ['storyville', 'medley-templates', 'signin']
@jself
jself / .zshrc
Created June 7, 2012 00:15
My .zshrc
#init compinit, colors
autoload -Uz compinit; compinit
autoload -U colors && colors
#options
setopt inc_append_history
setopt share_history
setopt autopushd pushdminus pushdsilent pushdtohome
setopt auto_menu
setopt complete_in_word
#!/usr/bin/env python2
import urllib2
import sys
import re
import threading
from hashlib import md5
def get_images(url):
r = re.compile('//images.4chan.org/[^"]*(?:.jpg|.jpeg|.bmp|.gif|.png)')
def wrapper(func):
def newfunc(*args, **kwargs):
print "In the new func, ignoring the old"
return newfunc
@wrapper
def hello():
print "In hello func"
hello()
class A(object):
def printer(self, text):
print text
def wrapped(func):
def newprinter(self, text):
print "Here: %s"%text
return newprinter
@jself
jself / gist:5124848
Last active December 14, 2015 17:49
def get_agent_id(self, agent_id):
if not hasattr(self, '_agent_ids'):
self._agent_ids = {}
if agent_id in self.agent_ids:
return self.agent_ids[agent_id]
a_id_list = self.list_agent_id()
for a in a_id_list:
if a == agent_id:
self.agent_ids[agent_id] = a
return a
@jself
jself / gist:7286131
Last active December 27, 2015 06:59
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"path/filepath"
)
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"path/filepath"
)