This file contains 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
use strict; | |
use warnings; | |
sub tz_offset | |
{ | |
my $t = shift; | |
my @l = localtime($t); | |
my @g = gmtime($t); | |
my $minutes = ($l[2] - $g[2] + ((($l[5]<<9)|$l[7]) <=> (($g[5]<<9)|$g[7])) * 24) * 60 + $l[1] - $g[1]; |
This file contains 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 perl | |
# generic HTTP to HTTP proxy server | |
use strict; | |
use Plack::Builder; | |
use Plack::App::Proxy; | |
my $error_500_res = [500, ['Content-Type' => 'text/plain'], [ "INTERNAL SERVER ERROR\n" ] ]; |
This file contains 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 lib 'lib'; | |
package My::Class; | |
use Moose; | |
has 'ref' => (is => 'rw', clearer => 'clear_ref'); | |
sub DISPOSE { warn "$_[0]\->DISPOSE called"; $_[0]->clear_ref } | |
sub DESTROY { warn "memory leak of @_" if ${^GLOBAL_PHASE} and ${^GLOBAL_PHASE} eq 'DESTRUCT'; } | |
package main; |
This file contains 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 | |
file="$1" | |
if [ -z "$file" ]; then | |
echo "Usage: $0 file" | |
exit 1 | |
fi | |
trap "rm -f $file.k12 $file.k12.uniq $file.cap; exit 1" 0 1 2 3 15 |
This file contains 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
uwsgi_psgi --http localhost:5000 --remap-modifier 5:0 --psgi hello.psgi |
This file contains 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
die () { | |
echo "$@" 1>&2 | |
exit 1 | |
} |
This file contains 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 -c | |
# twiggy apt-cache.psgi | |
use Plack::Builder; | |
use Plack::App::Proxy; | |
builder { | |
enable 'AccessLog'; | |
enable 'Cache', |
This file contains 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
# Extracts mpeg files. | |
# Depends on avconv | |
4 string ftypisom | |
extension mp4 | |
command dd of="$1.tmp" bs=1024k count=40; avconv -i "$1.tmp" -c:v copy "$1"; rm -f "$1.tmp" | |
min_output_file 102400 |
This file contains 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 v5.10; | |
use Scalar::Util 'looks_like_number'; | |
my $rate = looks_like_number $ARGV[0] ? shift @ARGV : 25.000; | |
for my $filein (@ARGV) { | |
open my $fhin, "<:crlf:encoding(cp-1250)", $filein or die "open: $filein: $!"; |
This file contains 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 Pod::Usage; | |
use Getopt::Long; | |
use strict; | |
use warnings; | |
GetOptions( | |
\my %opts, |