Skip to content

Instantly share code, notes, and snippets.

View agateau's full-sized avatar

Aurélien Gâteau agateau

View GitHub Profile
@agateau
agateau / cmdline.sh
Last active January 28, 2022 04:49
#!/bin/bash
set -e
PROGNAME=$(basename $0)
die() {
echo "$PROGNAME: $*" >&2
exit 1
}
@agateau
agateau / inlinestaticplugin.py
Created October 18, 2013 15:20
Pelican plugin to copy over inline static files (files inside content folders)
import os
import logging
import shutil
from pelican import signals
from pelican.generators import Generator
from pelican.utils import mkdir_p
logger = logging.getLogger(__name__)
@agateau
agateau / reviewboard-review-id-greasemonkey.js
Last active December 25, 2015 21:19
Greasemonkey script to make it easier to copy'n'paste review id
// ==UserScript==
// @name ReviewBoard - easy-to-copy review id
// @namespace http://agateau.com/
// @description Insert the review id in a readonly input field next to the star image, making it easier to copy
// @include https://*/r/*
// @grant none
// @version 1
// ==/UserScript==
var elements = document.getElementsByClassName("star");
@agateau
agateau / kde-post-review
Last active December 22, 2015 17:39
Wrapper around post-review to create reviews on http://git.reviewboard.kde.org
#!/bin/sh
set -e
REVIEWBOARD_URL="https://git.reviewboard.kde.org"
err() {
echo "$*" 1>&2
}
usage() {
@agateau
agateau / dmenu_open
Last active December 20, 2015 17:59
dmenu_open, short script to browse folders and open documents
#!/bin/sh
set -e
DMENU_ARGS=" -b -nb #444 -nf #eee -sb #666"
if [ $# = 1 ] ; then
dir="$1"
else
dir=$HOME
fi
@agateau
agateau / labelstick
Created July 2, 2013 13:19
Quick script to set labels of vfat volumes. Useful to name usb sticks.
#!/usr/bin/env python
import os
import re
import signal
import subprocess
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
#!/bin/sh
set -e
usage() {
cat <<EOF
USAGE: $(basename $0) <action>
Setup symlinks on an Ubuntu installation to work on Ubiquity
@agateau
agateau / benchqlist.cpp
Created March 18, 2013 13:44
Benchmarks how QList::reserve() affects QList performance
// Build with: g++ benchqlist.cpp -o benchqlist -I/usr/include/qt4 -Wall -lQtCore -lstdc++ -O2
#include <QtCore/QList>
#include <QtCore/QElapsedTimer>
#include <QtCore/QDebug>
#if 1
#define ELEMENT int
#define ELEMENT_VALUE 12
#else
@agateau
agateau / vl.py
Created February 7, 2013 10:25
Handy tool to extract filename and line number from a line of text and open vi on it
#!/usr/bin/env python
# encoding: utf-8
import re
import os
import sys
import argparse
DESCRIPTION = """\
Try to figure out a filename and line number from the command line arguments
and start vi on it. This is handy to quickly edit a faulty line by copy and
@agateau
agateau / reviewboard-am.py
Last active October 10, 2015 05:07
Apply patches from KDE reviewboard, using author info and description from reviewboard
#!/usr/bin/env python
# encoding: utf-8
import json
import os
import subprocess
import sys
import urllib2
from optparse import OptionParser