Skip to content

Instantly share code, notes, and snippets.

@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 – [email protected]
# 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 / r00.bash
Created November 22, 2010 23:12
A wrapper around RAR(1) for making archives on the form .rar .r00 etc.
#!/bin/bash
# Make rar multiparts with the extensions .rar .r00 etc.
# Many programs prefer / look for this, not the .partX.rar
# Usage: r00 [archive name OR file1] [file(s)]
# Enable evil expansion mode: +([0-9])
shopt -s extglob
for arg in "$@" ; do
@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 / playlist.bash
Last active November 7, 2024 17:07
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 / mangastream.py
Created August 5, 2010 02:48
Manga Stream “direct download” by scraper
#!/usr/bin/env python
"""%prog [-d] Manga [chapter]
NOTE: Does not work any more!
I probably won't fix it. Ever.
Patches accepted =)
Quick and dirty: Manga Stream direct download hack.
Fetches a named comic matching the regex given on cmd line. E.g:
@xim
xim / rarx.bash
Created July 11, 2010 20:08
Unrar recursively in bash, using evil™
#!/bin/bash -xv
# ^^ debug, feel free to remove...
# Enable evil expansion mode: +([0-9])
shopt -s extglob
do_unrar() {
rar x "$@"
}
@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.