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: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 / 3col.grid
Created November 7, 2015 09:21
GridMove setup for 3 Columns per screen
[Groups]
NumberOfGroups = 9
[1]
TriggerTop = [Monitor1Top]
TriggerRight = [Monitor1Left] + [Monitor1Width] / 3
TriggerBottom = [Monitor1Bottom]
TriggerLeft = [Monitor1Left]
[2]
#!/bin/bash
#
# Script to find lingering PostgreSQL data files.
#
# Those files can usually be safely removed from disk.
#
# Use at your own risk!
#
# Based on http://dba.stackexchange.com/a/121876/34652
@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: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 / 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: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:5875917
Created June 27, 2013 12:02
Redmine query aimed at the "my page" route.
-- The following query conbines the task due-date with the priority and sorts with the combined value.
SELECT id, project_id, subject, due_date, status_id,priority_id,author_id, priority_id * EXTRACT(EPOCH FROM AGE(due_date))
FROM issues
WHERE assigned_to_id=3 OR
author_id=3 AND
status_id IN (SELECT id FROM issue_statuses WHERE NOT is_closed)
ORDER BY (priority_id * EXTRACT(EPOCH FROM AGE(due_date))) DESC NULLS LAST,
priority_id DESC;
class RepresentableBase(object):
"""
This class can be used by ``declarative_base``, to add an automatic
``__repr__`` method to *all* subclasses of ``Base``. This ``__repr__`` will
represent values as::
ClassName(pkey_1=value_1, pkey_2=value_2, ..., pkey_n=value_n)
where ``pkey_1..pkey_n`` are the primary key columns of the mapped table
with the corresponding values.
@exhuma
exhuma / client.bash
Created November 11, 2013 10:50
URL decoding in Flask
clear && curl http://localhost:5000/foo+bar
curl http://localhost:5000/foo%20bar