Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
for control in *.control ; do
equivs-build $control
done
@pmakholm
pmakholm / tweet-get.pl
Created September 18, 2010 14:17
Getting OAuth enabled RSS feeds from twitter.com
#!/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;
@pmakholm
pmakholm / dkhm-update-ds
Created October 8, 2010 16:16
Script for updating DS records for .dk domains
#!/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
#
@pmakholm
pmakholm / gist:1106536
Created July 26, 2011 11:30
Streaming PSGI with IO::AIO
my $app = sub {
return sub {
my $response = shift;
my $writer = $response->( [ 200, [] ] );
my $buffer = "a" x 1024;
$writer->write( $buffer );
$buffer =~ y/a/b/;
}
@pmakholm
pmakholm / abstract.txt
Created January 24, 2012 19:53
Suggested talk for OpenSourceDays 2012
Title: Modern Web Programming in Perl
Duration: 45 minutes
In year 1997 dynamic web pages often consisted of HTML forms you could
submit to the server and get a full HTML page back. The standard
language for writing the server code was Perl and it is quite probable
that the worst code ever written in any language is written in Perl
about 15 years ago to handle some HTML form processing.
Since then different languages has been hyped as *the* language for
@pmakholm
pmakholm / gist:2214047
Created March 27, 2012 08:38
Udtræk af §20-spørgsmål
WITH MT AS ( SELECT row_number() over ( ORDER BY CASE WHEN
ftcn_casenumber.ftcn_casetypedesc in ('B ', 'S ', 'L ', 'Aktstk.', 'US') THEN
UPPER(ftcn_casenumber.ftcn_casetypedesc + ' ' + REPLICATE('0', 50 -
len(ftcn_casenumber.ftcn_casenumber)) + ftcn_casenumber.ftcn_casenumber + ' ' +
IsNull(ftcn_casenumber.ftcn_casenosuffix, '') + ' ' + REPLICATE('0', 50 -
len(convert(varchar(10),IsNull(documentParagraphNumber,0)))) +
convert(varchar(10),IsNull(documentParagraphNumber,0))) ELSE ( CASE WHEN
caseTypeRecno=100012 then 'UM-DEL' WHEN caseTypeRecno=100001 THEN 'ALM. DEL ' +
committeeAbbreviation + ' ' + REPLICATE('0', 50 -
len(convert(varchar(10),IsNull(documentParagraphNumber,0)))) +
@pmakholm
pmakholm / gist:2214090
Created March 27, 2012 08:47
Udtræk af §20-spørgsmål (XML)
<?xml version="1.0" encoding="utf-8"?>
<!--
2011-07-28: Tilføjet RSS
2009-08-05: Helt nyt view og parfil. OBS parameter minister daekker over ministerArea
2009-04-18: PEP Rediget til optimering (udkommentering spørgsmåltyper)
2009-03-26: Redigeret til samrådsspm.
2009-03-19: SYNKRONISERET til alle servere
2008-05-11: denne configuration er OK PEP
2010-04-06: rettet sortering på nr. JOKR
@pmakholm
pmakholm / gist:2575267
Created May 2, 2012 08:55
Finding files in git
#!/bin/sh
for commit in $( git log --format=format:%H ) ; do
git ls-tree -r $commit | while read line ; do
echo $commit $line
done
done | grep $( git hash-object $1 )
package PlackX::Util::Middelware;
use Plack::Util;
sub handle_response {
my ($res, %callback) = @_;
$callback{on_chunk} = sub { 1 };
$callback{on_close} = sub { 1 };
use Plack::Builder;
my $access_log = ...;
builder {
open my $logfh, ">>", $access_log
or die "Couldn't open $access_log: $!";
enable "AccessLog::Timed",
format => "%v %h %l %u %t \"%r\" %>s %b %D",