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 / 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 / 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 / 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 / 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 / cmdline.sh
Last active January 28, 2022 04:49
#!/bin/bash
set -e
PROGNAME=$(basename $0)
die() {
echo "$PROGNAME: $*" >&2
exit 1
}
@agateau
agateau / save-layers.py
Last active August 29, 2015 14:07
Save GIMP layers as individual png files
#!/usr/bin/python
"""
Saves all visible layers of an image as individual png files in the same
folder as the image, using <layer-name>.png for the name.
To use it:
- Save this file in ~/.gimp-$version/plug-ins/
- Restart GIMP
- Open the Image menu, select "Save Layers"
@agateau
agateau / ctags.vim
Created November 14, 2014 09:25
Modified version of ctags.vim, which shows class names in addition to the function names
" ctags.vim: Display function name in the title bar and/or status line.
" Author: Alexey Marinichev <[email protected]>
" Maintainer: Gary Johnson <[email protected]>
" Contributor: Keith Reynolds
" Last Change: 2003-11-26 00:23:22
" Version: 2.1
" URL(1.0): http://vim.sourceforge.net/scripts/script.php?script_id=12
" URL(>=2.0): http://vim.sourceforge.net/scripts/script.php?script_id=610
" DETAILED DESCRIPTION:
@agateau
agateau / bleachcheck
Created March 31, 2015 07:50
Check if files can be safely removed, according to lsof
#!/bin/sh
set -e
can_be_removed=""
keep=""
for x in * ; do
if [ ! -f "$x" ] ; then
continue
fi
if lsof "$x" > /dev/null ; then
@agateau
agateau / bisect-node-modules
Created May 15, 2015 13:02
A tool to "bisect" Node modules, useful to find out which module is causing failures
#!/bin/sh
set -e
# A tool to "bisect" Node modules, useful to find out which module is causing
# failures.
#
# Given a `node_modules` list known to work and one which is known to be broken,
# do the following:
#
# mkdir /tmp/base_dir
@agateau
agateau / 4i1m.py
Created November 5, 2016 18:40
Given a set of letters and a length, finds all words known to hunspell dictionary
#!/usr/bin/env python3
import argparse
import os
import sys
from itertools import permutations
import hunspell