Skip to content

Instantly share code, notes, and snippets.

View tadzik's full-sized avatar
🐴

Tadeusz Sośnierz tadzik

🐴
View GitHub Profile
[Hash w xmpbot.pm] ===> en { ping => asd, help => fasd}
||
====> pl { ping => asd, pomoc => fasd }
||
=====> de { ping => asd, hilfe => fasd }
pseudokod:
sub on_message (command, args, jid) {
if (lang = getlang(jid)) {
[Hash w xmpbot.pm] ===> en { ping => asd, help => fasd}
||
====> pl { ping => asd, pomoc => fasd }
||
=====> de { ping => asd, hilfe => fasd }
pseudokod:
sub on_message (command, args, jid) {
if (lang = getlang(jid)) {
We couldn’t find that file to show.
module Digest::djb2;
sub hash(Buf $input) is export {
my Int $hash = 5381; # 5381 is one of two 'magic numbers' used in this algorithm
for 0..$input.elems-1 {
$hash = (($hash +< 5) + $hash) + $input[$_]; # 33 is second
}
return $hash;
}
use v6;
sub notice (Str $what) {
say "\e[1m==> ", $what, "\e[0m";
}
sub MAIN (Str $url) {
my $res; # for various run() calls
my $workdir = '.protominus.tmpdir';
if $workdir.IO ~~ :e {
package xmpbot::Plugin::Echo;
use Moose;
with 'xmpbot::Plugin';
sub BUILD {
my $self = shift;
$self->register_command('echo');
}
sub echo {
use File::Copy;
use File::Find;
use File::Mkdir;
module Module::Install;
sub install(Str $dir = '.', Str $dest = "%*ENV<HOME>/.perl6/") is export {
if $*VM<config><osname> ne 'MSWin32'
&& "$dir/Makefile".IO ~~ :f {
run 'make install' and die "'make install' failed";
┌─[tadzik@yavin4]─[~/src/perl6-Module-Tools]
└─[%]─> PERL6LIB=lib perl6 -e 'use Module::Install; install()'
toying with ./lib/Module/Build.pir
target dir is /home/tadzik/.perl6/lib/Module
Starting copying, time is 1284230402
Done copying, time is 1284230423
toying with ./lib/Module/Install.pir
target dir is /home/tadzik/.perl6/lib/Module
Starting copying, time is 1284230423
Done copying, time is 1284230432
┌─[tadzik@yavin4]─[~]
└─[%]─> ck4up
/usr/bin/ck4up:187: [BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18 revision 29036) [linux]
-- control frame ----------
c:0008 p:---- s:0033 b:0033 l:000032 d:000032 CFUNC :(null)
c:0007 p:---- s:0031 b:0031 l:000030 d:000030 CFUNC :digest
c:0006 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC :hexdigest
c:0005 p:0137 s:0025 b:0024 l:000023 d:000023 METHOD /usr/bin/ck4up:187
@tadzik
tadzik / bj.pl
Created September 28, 2010 12:29
my @s=<♠ ♣ ♥ ♦>;my @r=2..10,<jack queen king ace>;my %v=:jack(10),:queen(10),:king(10),:ace(1|11);my @d=map {[$^s,$^r]},(@s X @r);@d.=pick(*);my @p=[],[];sub a(@c is rw){@c.unshift(@d.shift)};sub b(@c){my $v=@c.map({%v{.[1]}||.[1]}).reduce(*+*);$($v.grep({$_ <21}))||$v[0]};for @p {a($_);a($_)};for @p {say '-'x 33;loop {if b($_)>21 {say $_~' is over 21';last};say b($_);say ~$_;last if prompt('(h) hit (s) sit? ')~~'s';a($_)}};say "Winner: {[max]@p.grep({b($_) <=21})}";