Skip to content

Instantly share code, notes, and snippets.

@silvasur
silvasur / ToroWorkaround.php
Created May 3, 2014 19:57
A Workaround for issue #82 of anandkunal/ToroPHP
<?php
class ToroWorkaround {
public static function serve($handlers) {
/*
* Toro prefers the $_SERVER["PATH_INFO"] var to get the requested URL.
* If this var is present, everything seems to be correct.
* If it is not, some weird errors occur.
* For example, Toro sometimes can not route to the index route ("/"), when the app is not running from the servers document root.
* By constructing PATH_INFO manually using REQUEST_URI and SCRIPT_NAME, we can work around this problem.
@silvasur
silvasur / martinaundmoritz.sh
Created July 26, 2014 21:29
Martina und Moritz Rezepte etwas besser druckbar aufbereiten
#!/bin/sh
# Extrahieren von [Martina und Moritz](http://martinaundmoritz.wdr.de/) Rezepten
# und aufbereiten in etwas besser druckbaren Stil.
# Klappt vielleicht auch mit anderen WDR-Rezepten.
extract_and_style() {
echo '<html>
<head>
<meta charset="utf-8"/>
@silvasur
silvasur / mass-mp3-retag.sh
Created August 18, 2014 20:14
Mass retagging of mp3 files that don't have ID3 tags
#!/bin/sh
# Mass retagging of mp3 files that don't have ID3 tags.
# The MP3 files must be named like this to use this script:
# ./<first letter of artist>/<artist>/<album>/<track number> - <title>.<file extension(s)>
# ^-- The current working directory
exsomething() { echo "$1" | sed 's#'"$2"'#\1#'; }
exartist() { exsomething "$1" '^\././\([^/]*\)/.*$'; }
exalbum() { exsomething "$1" '^\././[^/]*/\([^/]*\)/.*$'; }
@silvasur
silvasur / jpeginjector.sh
Created March 26, 2011 20:56
Easily inject files into jpeg files (using the comment tag in the EXIF data)
#!/bin/bash
# jpegincector.sh - Easily inject files into jpeg files (using the comment tag in the EXIF data)
# You need this tools / programs to run jpeginjector.sh:
# * uuencode/uudecode (usually found in the sharutils package)
# * exiftool (usually found in the perl-Image-ExifTool package)
# * uuidgen (usually already installed)
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
@silvasur
silvasur / tidy-up-youtube.css
Created April 9, 2011 19:09
Tidy up the youtube homepage, i.e. remove the right sidebar and the "most popular" videos.
/*
* Tidy up the youtube homepage, i.e. remove the right sidebar and the "most popular" videos.
*/
#homepage-side-content, #feed_top_videos, #feed_top_videos-content, .top-videos-module {
display: none !important;
}
@silvasur
silvasur / fb_dont_show_sidebar.css
Created July 7, 2011 11:49
Get rid of the stupid chat sidebar at facebook.com
.fbChatSidebar {
display: none !important;
}
/*
Installation instructions:
Opera:
1. Open Preferences, go to Advanced > Content > Style Options > Presentation mode and check Author mode : My style sheet
2. Go to Facebook,right-click on the page background and click "Edit Site Preferences".
@silvasur
silvasur / aurfetch.py
Last active October 11, 2015 13:37
Yet another AUR package downloader...
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# aurfetch.py - My small helper script for fetching AUR packages and automatically update them
# It doesn't do the fancier stuff like automagically fetch dependencies.
# Have fun :-)
#
# License: [Do What The Fuck You Want To Public License](http://en.wikipedia.org/wiki/WTFPL)
###### START EDITING HERE
@silvasur
silvasur / rotationen.m
Created November 16, 2012 19:36
Rotations/Quaternionsfunktioen für Octave/MATLAB
% DISCLAIMER: Nur in Octave getestet. Könnte auch in MATLAB funktionieren, muss aber nicht...
% Achse-Winkeldarstellung zu Rotationsmatrix.
function rv = achsewinkel_to_rotmatrix(achse, winkel)
x = achse(1);
y = achse(2);
z = achse(3);
c = cos(winkel);
s = sin(winkel);
omc = 1-c;
@silvasur
silvasur / backup-bitcoins.sh
Created April 10, 2011 11:54
Easily create encrypted backups of your Bitcoin wallet
#!/bin/bash
# backup-bitcoins.sh - Easily create encrypted backups of your Bitcoin wallet
# You need this tools / programs to run backup-bitcoins.sh:
# * 7z (usually in the package 7zip)
# * uuidgen (usually already installed)
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
@silvasur
silvasur / fix.php
Created October 1, 2013 22:54
Fixes the metadata files of a Ratatöskr plugin repository.
#!/usr/bin/env php
<?php
/*
This will repair the metadata of the packages in your repository.
Place it into the root directory of your reository and run it via the terminal (php fix.php).
If everything has worked, nothing will be printed.
You should delete this script after fixing the metadata.
*/