Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

#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)
#!/bin/bash
if [[ $1 =~ ^http ]]; then #http, https
url=$1
else # everything else
url="http://$1"
fi
escaped=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0], "(),");' "$url")
firefox -P default -remote "openURL(${escaped}, new-tab)"
#!/bin/sh
url=$(xclip -o | sed -e 's/^\s*//' -e 's/\s*$//' | grep -v '^$' | head -n 1)
x-www-browser "$url"
@vrs
vrs / uvim
Created November 26, 2014 12:29
#!/bin/sh
exec ${emulator:=urxvtcd} -e vim "$@"
#!/bin/sh
temp=$(mktemp)
echo "### clipboard ###" > "$temp"
xclip -o >> "$temp"
env emulator=urxvt uvim -b -c 'set noeol' "$temp" +
sed 1d "$temp" | xclip -i
rm "$temp"
#!/usr/bin/python
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.
#!/bin/sh
# canything can be found here: https://github.com/keiji0/canything
focus=$(xdotool getwindowfocus)
list="./folders"
tosort=$1
if [ -z "$tosort" ]
then
echo "read script source."
exit 1
@vrs
vrs / pastefix
Last active August 29, 2015 14:04
#!/bin/sh
# 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 https://github.com/wh5a/arch/commit/623faac500a0eeb31477b0374b3080eaf2ed3685
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
vrs / ssh.sh
Created January 25, 2011 08:02
No Internet for you!
#!/bin/bash
# $@: ircssh, a shell account with irssi running
# xmonad line:
# , ("M-S-i", spawn "gnome-terminal -e 'Skripte/ssh.sh ircssh'")
if [[ `date +%k` -lt 18 || `date +%k` -gt 20 ]]
then
echo "Internet geschlossen, Öffnungszeiten 18 bis 21 Uhr."
read
exit 1
fi
#!/usr/bin/perl -w
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.01";
%IRSSI = (
name => 'qwertz.pl',