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 / wide-i18n-strings.cpp
Created December 24, 2010 13:31
Debug issues when strings get too wide to fit a window by prefixing translated strings with a custom string
QString wide_prefix()
{
return qgetenv("WIDE");
}
inline QString wide_i18n(const char* txt)
{
return wide_prefix() + i18n(txt);
}
@agateau
agateau / pkgcgrep.sh
Created September 29, 2011 13:36
Search through pkgconfig files
function pkgcgrep() {
pkg-config --list-all | grep "$1"
}
@agateau
agateau / pict-exif-rename
Created January 4, 2012 21:48
Rename pictures according to their exif information, taking sequence number into account
#!/usr/bin/env python
# encoding: utf-8
"""
pict-exif-rename: Rename pictures according to their exif information, taking
sequence number into account.
This relies on the presence of the Exif.Panasonic.SequenceNumber tag, so may
not work with all cameras.
@agateau
agateau / pyqt-webkit-tut2.py
Created January 20, 2012 13:36
Demonstrate how to expose a PyQt object to QWebView
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
class Foo(QObject):
@pyqtSlot(int, result=int)
def compute(self, value):
return value * 2
@agateau
agateau / cp-clementine-covers.py
Created March 27, 2012 14:33
Copy album covers downloaded by Clementine in the matching album dir
#!/usr/bin/env python
# encoding: utf-8
# Author: Aurélien Gâteau <agateau@kde.org>
# License: GPLv3+
import filecmp
import os
import shutil
import sqlite3
@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
@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 / 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
#!/bin/sh
set -e
usage() {
cat <<EOF
USAGE: $(basename $0) <action>
Setup symlinks on an Ubuntu installation to work on Ubiquity
@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 *