Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# (C) 2008 Canonical Ltd.
# Author: Martin Pitt <martin.pitt@ubuntu.com>
# License: GPL v2 or later
# modified by David D Lowe and Thomas Detoux
# Debian 7 support by pixline <pixline@gmail.com>
# It NEEDS /bin/bash, dash won't work (sed issues).
#
# Setup user and temporary home directory for guest session.
#include "grabberdialog.h"
#include <QDebug>
#include <QGuiApplication>
#include <QLabel>
#include <QPixmap>
#include <QPushButton>
#include <QScreen>
#include <QVBoxLayout>
#include <QWindow>
@xim
xim / sendmail-checkattach-ng.bash
Created June 25, 2010 13:07
CheckAttach NG bash script
#!/bin/bash
# Sendmail replacement inspired by CheckAttach script for mutt.
# http://wiki.mutt.org/?ConfigTricks/CheckAttach for the original script.
# To use, simply add the following line to your .muttrc:
# set sendmail="/path/to/this/script -oi -oem"
# Note that -oi -oem are the default parameters given by mutt to sendmail. You
# could also use e.g. -t -i or... whatever floats your boat :)
# Then restart mutt.
@xim
xim / playlist.bash
Created October 25, 2010 16:10
mplayer wrapper for making playlists
#!/bin/bash -f
SORT="sort -n"
filter="-type f"
DENIED_EXTS="txt m3u pls jpg jpeg gif nfo srt sub torrent zip rar cbz cbr"
if [[ "$1" =~ ^- && "$1" != "--help" ]] ;then
if [[ "$1" = "--cat" ]] ; then
SORT="cat"
@xim
xim / annoy.pl
Created November 9, 2010 21:39
A short and annoying script for irssi, made on request :p
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = '0.1';
%IRSSI = (
authors => 'Morten M. Neergaard',
contact => 'user xim some major IRC networks? =)',
name => 'annoy.pl',
description => '/annoy <msg> # sends <msg> to all in current channel (except me)',
license => 'Who cares',
@xim
xim / go2.py
Created May 19, 2011 01:34
Hack for opening arbitrary files in gnome using their default program
#! /usr/bin/env python
# encoding: utf-8
# Written by Morten Minde Neergaard – m@8d.no
# Based on idea from http://therning.org/magnus/archives/251
"""
Open a file in a manner similar to gnome-open.
Fall back to using xdg-open.
Return code: The sum of all return codes given by the called programs.
@xim
xim / custom-term.patch
Created September 24, 2012 07:18
Quick patch to oe to allow custom terminals.
diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass
index 3cfc84b..906fa58 100644
--- a/meta/classes/terminal.bbclass
+++ b/meta/classes/terminal.bbclass
@@ -4,7 +4,7 @@ OE_TERMINAL[choices] = 'auto none \
${@" ".join(o.name \
for o in oe.terminal.prioritized())}'
-OE_TERMINAL_EXPORTS = 'XAUTHORITY SHELL DBUS_SESSION_BUS_ADDRESS DISPLAY EXTRA_OEMAKE SCREENDIR'
+OE_TERMINAL_EXPORTS += 'XAUTHORITY SHELL DBUS_SESSION_BUS_ADDRESS DISPLAY EXTRA_OEMAKE SCREENDIR'
@xim
xim / README.md
Last active November 4, 2015 18:08
QTBUG-49238

This code reproduces QTBUG-49238.

@xim
xim / statements.py
Last active December 16, 2015 10:29
#!/usr/bin/env python
import re
statement_matcher = re.compile(r'^s(.)(?:(?!\1).)*\1(?:(?!\1).)*\1$')
def get_interesting_triplets(dictionary_file, statement_file):
with open(dictionary_file) as fh:
words = [word.strip() for word in fh.readlines()]
@xim
xim / bashrc.append
Last active December 20, 2015 11:29
Vim function for your .bashrc. Turns "vim file1:42 file2:1337" into "/usr/bin/vim file1 file2 -S (script that moves the cursor to the correct line)"
# vim file:34 otherfile:1337 -> Open files at respective lines. And in tabs!
vim() {
declare -a args
let fcount=0
hit_dashdash=
for arg in "$@" ;do
if [[ "$arg" =~ ^- && ! "$hit_dashdash" ]] ;then
args+=("$arg")
[[ "$arg" = "--" ]] && hit_dashdash=1
continue