This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script makes Konsole tab names always reflect the hostname of the current host. | |
# | |
# You're supposed to rename this script as "ssh" and put it into a | |
# directory that precedes /usr/bin in your $PATH, like /usr/local/bin | |
if [ "x$KONSOLE_DCOP_SESSION" = "x" ]; then | |
exec ssh $* | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 HOSTNAME NOTIFICATION-SCRIPT-URL" | |
echo "Ping HOSTNAME and if it's down then WOL it and send a notification mail to the admin." | |
echo "NOTIFICATION-SCRIPT-URL?host=HOSTNAME will be fetched to send the actual mail." | |
echo "Example: $0 mybox http://mydomain.com/notifyme.php" | |
exit | |
fi | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$accepted_languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); | |
$primary_language = $accepted_languages[0]; | |
if ($pos=strpos($primary_language, ';') !== false) { | |
$primary_language = substr($primary_language, 0, $pos+1); // Throw away quality value. | |
} | |
if ($pos=strpos($primary_language, '-') !== false) { | |
$primary_language = substr($primary_language, 0, $pos+1); // Throw away dialect. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
from sys import argv, exit | |
from shutil import copyfile | |
from pyinotify import * | |
def add_watch(): | |
global watch_manager, watch_descriptor, file_to_stick | |
watches = watch_manager.add_watch(file_to_stick, IN_MODIFY | IN_DELETE_SELF) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do | |
inotifywait -q -q -e modify -e delete $2 | |
cp $1 $2 | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// It's a webscraper that converts the most recent posts of the | |
// Mechanical Keyboard Guide forum thread of Overclock.net to RSS. | |
// | |
// This piece of code used to work but not anymore because the site has changed its | |
// layout but it's expected - chasing a moving target is the nature of webscraping. | |
// | |
// MySQL table schema: | |
// CREATE TABLE IF NOT EXISTS `mechanical_keyboard_guide` ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!file_exists('../wp-config.php')) { | |
die('There doesn\'t seem to be a wp-config.php file. Double check ' . | |
'that you updated wp-config-sample.php with the proper database ' . | |
'connection information and renamed it to wp-config.php.'); | |
} | |
require('../wp-config.php'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This is a simple command line image manipulation utility that draws a red X to the image. | |
import sys | |
import gtk | |
if len(sys.argv) != 3: | |
print 'usage: x-this-image source-image destination-image' | |
sys.exit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Simple Pascal parser written in Prolog that prints the names and | |
% line numbers of the procedures and functions found in input.pas | |
% I put together this mess for the programming languages course of the university in 2005. | |
printIden(L) :- | |
get_char(C), | |
print(C), | |
C == ';' -> | |
print(' '), | |
print(L), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% This is a Mono advertisement postscript graphics that I created | |
% for the computer graphics course of the university in 2004. | |
/draw-monkey { % fg-color bg-color scale | |
dup | |
scale | |
newpath | |
0 0 moveto | |
0 0.95 lineto |