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
for (i = 0 ; i < threads ; i++) | |
spawn(worker thread); | |
while (1) { | |
cond_broadcast(ok_A); | |
for (i = 0 ; i < threads ; i++) down(done_A); | |
cond_broadcast(ok_B); | |
for (i = 0 ; i < threads ; i++) down(done_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
after 'prepare_path' => sub { | |
my $c = shift; | |
my $path = $c->req->path; | |
my $base = $c->req->base; | |
use URI; | |
if ($path =~ s{^([ab]/)}{}) { | |
my $removed = $1; |
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
andrew@mido:~/code/vt220-font$ perl -Ilib -MVT220 -e 'my $vt220 = VT220->new; $vt220->get_char("a")->display' | |
XXXXXX | |
XX | |
XXXXXXX | |
XX XXX | |
XXXXXXX |
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
# The Computer Language Shootout | |
# http://shootout.alioth.debian.org/ | |
# implemented by Greg Buchholz | |
# streamlined by Kalev Soikonen | |
# Multithreaded and reorganized by Andrew Rodland | |
use threads; | |
use threads::shared; | |
sub ITER () { 50 } |
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
*** String::RewritePrefix successfully installed. | |
*** Module::AutoInstall installation finished. | |
String found where operator expected at /home/andrew/cat580014test/lib/perl5/i486-linux-gnu-thread-multi/MooseX/Role/WithOverloading/Meta/Role/Application/Composite/ToClass.pm line 10, near "with 'MooseX::Role::WithOverloading::Meta::Role::Application::Composite'" | |
(Do you need to predeclare with?) |
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
$rs->select( | |
{}, | |
{ | |
select => [ { date => 'signup_date', -as => 'the_day' }, { count => '*' } ], | |
as => [ 'signup_date', 'signup_date_count' ], | |
group_by => [ 'the_day' ], | |
order_by => [ 'the_day desc' ], | |
} | |
); |
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
$\="\n"; # "print for ..." at the end puts stuff on new lines :) | |
$/=""; # paragraph mode. | |
@word = split//,pop; # Get the search word off of the commandline | |
($board=<>) =~ tr/ //d; | |
$width = 1 + index($board, "\n"); # How wide is the board? Find the first newline. | |
for (1,2) { | |
# Find the word forwards, southwest, south, and southeast. | |
for my $stride (0, $width - 2 .. $width) { | |
$pattern = join "."x $stride, @word; | |
# If it's in the board, record the start and end match positions. |
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
SELECT bands.name, COALESCE(pcount_raw, 0) AS pcount, COALESCE(vcount_raw, 0) AS vcount FROM bands | |
LEFT JOIN (SELECT band_id AS pbid, COUNT(id) as pcount_raw FROM polls GROUP BY pbid) | |
ON (bands.id=pbid) | |
LEFT JOIN (SELECT band_id AS vbid, COUNT(id) as vcount_raw FROM votes GROUP BY vbid) | |
ON (bands.id=vbid); |
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
Index: apps/plugins/imageviewer/png/png.c | |
=================================================================== | |
--- apps/plugins/imageviewer/png/png.c (revision 25692) | |
+++ apps/plugins/imageviewer/png/png.c (working copy) | |
@@ -1129,7 +1129,9 @@ | |
{ | |
if (chunkLength != 1) { decoder->error = 43; break; } /*error: this chunk must be 1 byte for indexed color image*/ | |
decoder->infoPng.background_defined = 1; | |
- decoder->infoPng.background_r = decoder->infoPng.background_g = decoder->infoPng.background_g = data[0]; | |
+ decoder->infoPng.background_r = decoder->infoPng.color.palette[4 * data[0] + 0]; |
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
#!perl | |
use strict; | |
use warnings; | |
use LWP::Simple; | |
use HTML::TreeBuilder; | |
my $t = HTML::TreeBuilder->new; | |
$t->parse_content(get "http://www.myp2p.eu/channel.php?country=us&part=channel"); |