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
package Foo; | |
my $i; | |
sub bar { | |
return ++$i; | |
} | |
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
package Bar; | |
use strict; | |
use DBI; | |
my $dbh = DBI->connect("dbi:Pg:dbname=savonarola", 'savonarola', '********', {AutoCommit => 1}); | |
sub rnd { | |
my $sth = $dbh->prepare("SELECT RANDOM()"); | |
$sth->execute(); |
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 -w | |
use strict; | |
use Benchmark; | |
use String::CRC32; | |
use Digest::MD5 qw(md5); | |
my $s = "1234" x 100; |
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/bash | |
display=`xrandr --prop | grep -v disconnected | grep connected | zenity --list --column Display --text "Choose primary display" --width 600 --height 200 | cut -d ' ' -f 1` | |
if [ "x$display" != "x" ]; then | |
xrandr --output $display --primary | |
fi |
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
// scala -P:continuations:enable cont.scala | |
import scala.util.continuations.{reset,shift,cpsParam} | |
def saveCont[A,B](resetFun : (Unit => A @cpsParam[B,Unit] ) => B @cpsParam[B,Unit]) : A => B = { | |
var cc : A => B = null; | |
val switchFun : (Unit => A @cpsParam[B,Unit] )= Unit => { | |
shift{ k : (A => B) => | |
cc = k | |
} | |
} |
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
#include <X11/Xlib.h> | |
void move(int dx, int dy) { | |
Display* d; | |
d = XOpenDisplay(0); | |
XWarpPointer(d,0,0,0,0,0,0,dx,dy); | |
XCloseDisplay(d); | |
} | |
int main(void) { |
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 -w | |
use strict; | |
use Benchmark; | |
my $h = { map { $_, $_ } 1..10000 }; | |
timethese( 1000, { | |
each => sub{ my $i = 0; while( my ($k, $v) = each %$h ) { $i++ } }, |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<items> | |
<item> | |
<TmpId>1</TmpId> | |
<Id>123</Id> | |
</item> | |
<item> | |
<TmpId>1</TmpId> | |
<Id>124</Id> | |
</item> |
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 -w | |
use strict; | |
use Redis; | |
use Data::Dumper; | |
use Digest::MD5 qw/md5/; | |
my ($key_count, $dump_period) = @ARGV; | |
my $r = Redis->new(); | |
sub key($) {unpack("H*", md5(shift))} |
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
ERLDIRS = %w{ | |
elibs | |
elibs/balancer | |
elibs/config | |
elibs/convert | |
elibs/driver | |
elibs/handler | |
elibs/helper | |
elibs/mysql | |
elibs/tcp |