Skip to content

Instantly share code, notes, and snippets.

View twidi's full-sized avatar
🕶️

Stéphane "Twidi" Angel twidi

🕶️
View GitHub Profile
index 1c0e8fa..23b0d4a 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -213,6 +213,7 @@ class Redis(threading.local):
string_keys_to_dict('ZRANGE ZRANGEBYSCORE ZREVRANGE', zset_score_pairs),
{
'BGSAVE': lambda r: r == 'Background saving started',
+ 'BGREWRITEAOF': lambda r: r == 'Background rewriting of AOF file started',
'HGETALL': lambda r: r and pairs_to_dict(r) or None,
'INFO': parse_info,
import threading
import Queue
q = Queue.Queue()
def worker():
while True:
msg = q.get(block=True)
# do stuff with the message
t = threading.Thread(target=worker)
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
@twidi
twidi / linear-git-to-git-flow.sh
Created December 11, 2010 17:40
A script to transform a linear flow in a git repository (all in master) in a flow named "git-flow" (http://nvie.com/posts/a-successful-git-branching-model/) with a master branch, a develop one, and one for each feature, hotfixe and release.
#!/bin/bash
# Explanations : http://bit.ly/gs2qpL
# give optionnaly a revision from where to start
# if not given initial_ref will be the first ref available
initial_ref='757794e524755d2eebc6d881fea026c308a11fd5'
# declare below all the steps whith this format :
# 'version type name ref' \
@twidi
twidi / google-reader-less-whitespace.css
Created November 1, 2011 13:35
CSS stylesheet for stylish (firefox) to remove some useless whitespace in the new google reader
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix("http://www.google.com/reader/view/"),url-prefix("https://www.google.com/reader/view/")
{
#top-bar {
height: 28px !important;
}
#search {
padding: 0 !important;
}
@twidi
twidi / input_reset.css
Created January 18, 2012 16:25
CSS to reset input and buttons to be "neutral" (to make a button like a link, for example)
button.reset, input.reset {
border: none;
background: transparent;
cursor: pointer;
margin: 0;
padding: 0;
text-align: left;
border-radius: 0;
box-shadow: none;
}
@twidi
twidi / context2dict.py
Created May 14, 2012 14:25
Get a real dict from a django context (usefull when debugging)
def context2dict(context):
result = {}
for dic in reversed(context.dicts):
try:
result.update(dic)
except:
try:
result.update(context2dict(dic))
except:
pass
@twidi
twidi / .bashrc
Created June 5, 2012 09:35
bashrc settings for better history management
# don't put duplicate lines in the history and ignore lines starting by space(s)
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=50000
HISTFILESIZE=50000
@twidi
twidi / README.TXT
Created August 9, 2012 14:59
One key to toggle sidebar AND miniap in sublime-text-2
A simple way to toggle the display of the sidebar AND the minimap, with only one key binding.
Put "toggle_sidebar_and_minimap.py" in ~/.config/sublime-text-2/Packages/
and the content of "keymap" in your "Key bindings - User" file.
@twidi
twidi / gist:4978998
Created February 18, 2013 17:22
test2
foobar