Skip to content

Instantly share code, notes, and snippets.

View spawnwithpid.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
int forkstatus;
int exitstatus = 0;
void catch_sigterm () {
if (forkstatus != 0)
View x-www-browser
if [[ $1 =~ ^http ]]; then #http, https
else # everything else
escaped=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0], "(),");' "$url")
firefox -P default -remote "openURL(${escaped}, new-tab)"
View browsefromclipboard
url=$(xclip -o | sed -e 's/^\s*//' -e 's/\s*$//' | grep -v '^$' | head -n 1)
x-www-browser "$url"
vrs / uvim
Created November 26, 2014 12:29
View uvim
exec ${emulator:=urxvtcd} -e vim "$@"
View sanitizeclipboard
echo "### clipboard ###" > "$temp"
xclip -o >> "$temp"
env emulator=urxvt uvim -b -c 'set noeol' "$temp" +
sed 1d "$temp" | xclip -i
rm "$temp"
import random
import base64
"""Secret Santa generator 0.1, trusted 1-party version.
Ever been dissatisfied with random santa assignment because the group would break up into smaller circles? This script prevents this.
Usage: Edit seed and names, run the script. Each participant will have the obfuscated name of the presentee printed next to their name, run it through the base64 decoder of your choice to reveal it.
View surprisingly decent image sorter in a few lines of shell
# canything can be found here:
focus=$(xdotool getwindowfocus)
if [ -z "$tosort" ]
echo "read script source."
exit 1
vrs / pastefix
Last active August 29, 2015 14:04
View pastefix
# fix shift+ins pasting on gtk apps
# use by binding to shift+ins globally like so: ("S-<Insert>", spawn "pastefix")
# depends: xclip, xdotool
# inspired by
clipboard=$(xclip -o -selection clipboard)
xclip -o | xclip -selection clipboard
pid=$(xdotool getwindowfocus getwindowpid)
if head -c 1 >/dev/null 2>/dev/null /proc/$pid/maps && \
grep -q libgtk-x11 /proc/$pid/maps && \
vrs /
Created January 25, 2011 08:02
No Internet for you!
# $@: ircssh, a shell account with irssi running
# xmonad line:
# , ("M-S-i", spawn "gnome-terminal -e 'Skripte/ ircssh'")
if [[ `date +%k` -lt 18 || `date +%k` -gt 20 ]]
echo "Internet geschlossen, Öffnungszeiten 18 bis 21 Uhr."
exit 1
View gist:504649
#!/usr/bin/perl -w
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.01";
%IRSSI = (
name => '',