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 | |
# quick and dirty: Read from a udp socket and print to STDOUT | |
# usage: udpcat.pl <host> <port> | |
# or: udpcat.pl <host>:<port> | |
use strict; | |
use warnings; | |
use IO::Socket::INET; |
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 | |
=license | |
"THE BEER-WARE LICENSE" (Revision 42): | |
<[email protected]> wrote this file. As long as you retain this notice | |
you can do whatever you want with this stuff. If we meet some day, and | |
you think this stuff is worth it, you can buy me a beer in return | |
Peter Makholm |
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 | |
# | |
# An evil form of perl DESTROY-method | |
use strict; | |
use warnings; | |
{ | |
package Evil; | |
our @DESTROYED; |
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 | |
# Originaly at: | |
# http://idisk.mac.com/christian.hansen/Public/perl/serialize.pl | |
# Updated by Peter Makholm, June 2009 | |
# http://gist.github.com/130005 | |
# - Added Data::Dumper and a current set of YAML/JSON modules | |
# - added tags for the -b option: :core, :yaml, :json | |
# Updated by Peter Makholm, October 2009 | |
# - Moved main logic into Benchmark::Serialize |
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 |
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
# 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
#!/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
-- 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; | |
use strict; | |
use warnings; | |
# Simple 'head -n N' implementation: | |
use Getopt::Long; | |
my $lines = 10; | |
GetOptions( | |
"lines|n=i" => \$lines, |
OlderNewer