Skip to content

Instantly share code, notes, and snippets.

@silvasur
silvasur / tetris.py
Last active May 4, 2024 08:11
Tetris implementation in Python
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
# Very simple tetris implementation
#
# Control keys:
# Down - Drop stone faster
# Left/Right - Move stone
# Up - Rotate Stone clockwise
# Escape - Quit game
@silvasur
silvasur / gmail2opera.py
Created February 25, 2011 19:27
Convert GMails CSV contacts to Operas propertiary format.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# gmail2opera.py
# Copyright (c) 2010 Kevin Chabowski
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@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 / 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 / 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 / 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.
*/
@silvasur
silvasur / ruthe2atom.sh
Last active December 25, 2015 18:39
Fetch the latest cartoon from ruthe.de and build an Atom-Feed. You can use this with newsreaders that accept commands as a feed source (e.g. newsbeuter)
#!/bin/sh
# Released under the WTFPL (wtfpl.org).
URL="http://www.ruthe.de"
toonid=`curl -s $URL | sed -n 's/^.*archiv\.php\?.*id=\([0-9]*\).*/\1/p' | sed 1q`
now=`date +%Y-%m-%dT%H:%M:%SZ`
echo -n "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<feed xmlns=\"http://www.w3.org/2005/Atom\">