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
my $app = sub { | |
return sub { | |
my $response = shift; | |
my $writer = $response->( [ 200, [] ] ); | |
my $buffer = "a" x 1024; | |
$writer->write( $buffer ); | |
$buffer =~ y/a/b/; | |
} |
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/perl | |
# Script for updating DS records for .dk domains | |
# | |
# The following argument must be provided: | |
# --ns - You authorative nameserver you trust | |
# --zone - The zone you want to update DS records for | |
# --handle - Your DKHM handle | |
# --pasword - Your DKHM password | |
# |
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/perl | |
# Usage: | |
# - Get you own consumer_key and consumer_secret at http://dev.twitter.com/ | |
# - Add them to $HOME/.get-tweets.json | |
# - Run this script and follows the directions | |
# - Run this script with the rss feed url as argument | |
use feature ':5.10'; | |
use JSON::XS; |
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 | |
for control in *.control ; do | |
equivs-build $control | |
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
#!/usr/bin/perl; | |
use strict; | |
use warnings; | |
# Simple 'head -n N' implementation: | |
use Getopt::Long; | |
my $lines = 10; | |
GetOptions( | |
"lines|n=i" => \$lines, |
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
-- Standard awesome library | |
require("awful") | |
require("awful.rules") | |
require("awful.autofocus") | |
-- Theme handling library | |
require("beautiful") | |
-- Notification library | |
require("naughty") | |
-- Load Debian menu entries |
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/perl -ln | |
# Regular expression to validate dates on the forms 'YYYY-MM-DD' or 'YYYYMMDD' | |
$re = qr/(((0[48]|[2468][048]|[13579][26])00| \d\d(0[48]|[2468][048]|[13579][26] | |
))|(( [02468] [1235679]| [13579] [01345789])00 |\d\d([02468] [1235679]| | |
[13579][01345789]))(?!(-|)02\g{-1}29)) (?<sep>-|)(02(?!\g{sep}3)|0[469] | |
(?!\g{sep}31)|11(?!\g{sep} 31)|0[13578]|1[02])\g{sep}(0[1-9]|[12][0-9]| | |
3[01])/x; | |
print ($_=~ $re ? "Valid date" : "Invalid date"); |
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
# Shell snipet to handle multiple ssh-agents | |
# | |
# By default I use an ssh-agent with a lot of keys added with the -c option to | |
# ssh-add and this agent is forwarded trough most of my connections. | |
# But for some taske this confirmation step is a hassle, so I create new | |
# agents without confirmation with a minimal set of keys. | |
# | |
# You have to source this "script" to work or use the hack described at | |
# http://peter.makholm.net/2009/07/07/shell-hacks-bash-functions-in-files/ |
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
# Defaults: | |
PERL_LOCAL_LIB="home" | |
DIR=$HOME/.perl | |
if [ -n "$1" ]; then | |
PERL_LOCAL_LIB=$1 | |
fi | |
export PERL_LOCAL_LIB |
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
# Have easily editable functions in bash | |
# | |
# Usage: Place this script in $FUNCTIONS and call it from you .bashrc. | |
# Rerun the script each time you add new functions. | |
FUNCTIONS=$HOME/.lib.sh | |
eval $( | |
find $FUNCTIONS -type f | \ | |
while read file ; do echo function $(basename $file)\(\) { source $file\; }\; ; done |