Skip to content

Instantly share code, notes, and snippets.

View AdrienLemaire's full-sized avatar

Adrien Lemaire AdrienLemaire

View GitHub Profile
@AdrienLemaire
AdrienLemaire / fab_boto.py
Created October 19, 2011 03:50
Boto script
def restart_server(server_name=None):
"""Restart the server if needed (e.g. server down due to abusive cpu usage
by a program
how to use::
$ fab restart_server:serverName
List of available servers names:
@AdrienLemaire
AdrienLemaire / create_github_circle.py
Created October 3, 2011 06:49
Create a circle on Google+ for your github contacts
#!/usr/bin/env python
'''
File: create_github_circle.py
Author: Adrien Lemaire
Description: Generate a csv file for google+ using the github api 3
'''
import pycurl
import json
@AdrienLemaire
AdrienLemaire / ftpplugintex.vim
Created September 21, 2011 12:56
Mupdf hack to open pdf directly to the (sub)*section you're editing from vim in Latex
" Function: OpenPdfToSection
function! OpenPdfToSection()
let g:my_section = substitute(getline(search('\\\(sub\)\?section', 'bn')), '\\\%(sub\)\?section{\([^}]\+\)}', '\1', '')
" some weird trailing space can appear, remove them
let g:my_section = substitute(g:my_section, "^ *", "", "g")
let g:Tex_ViewRuleComplete_pdf = 'mupdf -f "'.g:my_section.'" -r 102 $*.pdf'
call Tex_ViewLaTeX()
" reinitialize the variable to keep <leader>lv working
let g:Tex_ViewRuleComplete_pdf = 'mupdf -r 102 $*.pdf'
endfunction
@AdrienLemaire
AdrienLemaire / fab_jip.py
Created August 1, 2011 13:27
Pip-like tool to keep js modules up to date from github
import os
from fabric.api import local, lcd
import default_settings as settings
class jip(object):
"""
Pip-like tool to manage all the static modules
@AdrienLemaire
AdrienLemaire / Questions
Created June 21, 2011 00:28
Kiwi Pycon Give-away
GitHub username: Fandekasp
Day job: Software Engineer
Favorite open source project: Python
Open Source contributions (if any): django-sphinx-autodoc, django-nuages (work in progress)
Stranded on an island, what 3 items do you take: swimsuit, laptop, wifi antenna
Tie-breaker, pick a number between 1 and 20,000: 15000
@AdrienLemaire
AdrienLemaire / todo.sh
Created May 21, 2011 10:29
Find all the TODO in a django project which need to be fixed
# Find all the TODO in the code which need to be fixed
echo "Templates"
grep -Irn --include=*.html --exclude-dir="coverage_html" "TODO" *
echo -e '\nPython'
grep -Irn --include=*.py --exclude-dir="coverage_html"\
--exclude-dir="development-tools" "TODO" *
echo -e '\nOther'
@AdrienLemaire
AdrienLemaire / gist:945542
Created April 28, 2011 00:22
Performance counter decorator
def time_and_log(func):
"""
A decorator to call a function and log the time spent inside
Usage:
@time_and_log
somefunc(someargs):
pass
"""