Skip to content

Instantly share code, notes, and snippets.

View exhuma's full-sized avatar
🐢
Slowly advancing on hobby projects

Michel Albert exhuma

🐢
Slowly advancing on hobby projects
View GitHub Profile
@exhuma
exhuma / gist:5858832
Created June 25, 2013 14:21
"Uploading" the contents of a variable using fabric.
def put_contents(value, remote_file, with_sudo=False):
"""
Uploads the contents of a variable to a remote file in a safe manner.
This will run ``mktemp`` on both the local and remote machine to reserve
unique temporary file names. Once the names are reserved, the file contents
are written as binary data into the local temp file. This local file is
then uploaded to the remote temp file and ultimately moved to the desired
destination.
@exhuma
exhuma / gist:5290703
Created April 2, 2013 08:13
plovr-build-error-2
Buildfile: /home/exhuma/work/__libs__/plovr/build.xml
pre-compile:
compile:
[mkdir] Created dir: /home/exhuma/work/__libs__/plovr/closure/closure-templates/build/classes
[mkdir] Created dir: /home/exhuma/work/__libs__/plovr/closure/closure-templates/build/genfiles
[mkdir] Created dir: /home/exhuma/work/__libs__/plovr/closure/closure-templates/build/genfiles/com/google/template/soy/exprparse
[mkdir] Created dir: /home/exhuma/work/__libs__/plovr/closure/closure-templates/build/genfiles/com/google/template/soy/soyparse
[javacc] Java Compiler Compiler Version 5.0 (Parser Generator)
@exhuma
exhuma / gist:5290652
Created April 2, 2013 07:59
plovr-build error
Buildfile: /home/exhuma/work/__libs__/plovr/build.xml
pre-compile:
compile:
[mkdir] Created dir: /home/exhuma/work/__libs__/plovr/closure/closure-templates/build/classes
[mkdir] Created dir: /home/exhuma/work/__libs__/plovr/closure/closure-templates/build/genfiles
[mkdir] Created dir: /home/exhuma/work/__libs__/plovr/closure/closure-templates/build/genfiles/com/google/template/soy/exprparse
[mkdir] Created dir: /home/exhuma/work/__libs__/plovr/closure/closure-templates/build/genfiles/com/google/template/soy/soyparse
[javacc] Java Compiler Compiler Version 5.0 (Parser Generator)
@exhuma
exhuma / profilter.py
Created January 2, 2013 11:53
Quick and dirty word filter, slammed together in a minute to answer a question on IRC
"""
quick-and-dirty word filter.
It could sure be made prettier. It's only purpose is to get the brain nudged into the right direction.
"""
BADWORDS = {
u'bad': u'b*d',
u'verybad': u'v*****d',
u'disgusting': u'#*$&^$%'
@exhuma
exhuma / gist:2136677
Created March 20, 2012 15:06
Bash completion for fabric
#
# Bash completion for fabric
#
function _fab_complete() {
local cur
if [[ -f "fabfile.py" || -d "fabfile" ]]; then
@exhuma
exhuma / gist:1682975
Created January 26, 2012 14:19
python config resolver
from ConfigParser import SafeConfigParser
from os import getenv, pathsep, getcwd
from os.path import expanduser, exists, join
import logging
LOG = logging.getLogger(__name__)
CONF = None
def config(group, app, search_path=None, conf_name=None, force_reload=False):
"""
@exhuma
exhuma / README.md
Created September 15, 2011 11:18
Personalized Web scripts for PostgreSQL Docs

Description

These files represent the different parts for the customisation for the PostgreSQL docs.

All to make the page a bit more readable

@exhuma
exhuma / about.md
Created August 10, 2011 07:14 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@exhuma
exhuma / gist:1079972
Created July 13, 2011 09:16
Linking (un)loading of your SSH private keys with your screensaver state
import dbus.mainloop.glib
import gobject
from subprocess import Popen
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
def screensaver_state_changed(new_state):
@exhuma
exhuma / inspectJobs.js
Created June 9, 2011 15:02
Query Windows Scheduled Tasks and do something with it
/**
* Naive CSV splitter
*
* This splitter is *very* simplistic and may result in errors when parsing
* unknown CSV sources. This works well in the current problem domain.
*
* As we have well defined data, with no escaped quotes inside the fields, we
* can sefaly assume that this will work.
*/
function simpleCsvSplit(lineText){