Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am bduggan on github.
  • I am bduggan (https://keybase.io/bduggan) on keybase.
  • I have a public key ASBRgyH0MlOEH4mWtv2eEswD4rWkMv3tM8WE39sKljcq3Ao

To claim this, I am signing this object:

#!/usr/bin/env perl6
use v6.c;
sub MAIN(Str $module) {
my $cu = $*REPO.need(CompUnit::DependencySpecification.new(:short-name($module)));
say $cu.distribution.prefix.child('sources/' ~ $cu.repo-id).path;
}
=begin pod
sub foo {
my @a = 1, 2;
my @b = 3, 4;
return @a, @b;
}
my (@c, @d) = foo();
say @c.perl;
say @d.perl;
#!/usr/bin/env perl6
sub cubic(\a,\b,\c,\d) {
my \Δ0 = b² - 3 × a × c;
my \Δ1 = 2 * b³ - 9 × a × b × c + 27 × a² × d;
my \C = ( ( Δ1 + sqrt( Δ1² - 4 × Δ0³ + 0i) ) / 2 ).roots(3)[0];
my \ς = 1.roots(3); # cubic roots of unity
return [0,1,2].map: -> \k {
( -1 / ( 3 × a ) ) × ( b + ς[k] × C + Δ0 / ( C × ς[k] ) )
}
use nqp;
my $compiler := nqp::getcomp('perl6');
my $repl = REPL.new($compiler, {});
my $save_ctx = nqp::null();
for ( '42',
'2+2',
'my $x = 2',
'$x',
'my $y:=3',
Saw 1 occurrence of deprecated code.
================================================================================
Method open (from IO::Handle) seen at:
SETTING::src/core/io_operators.pm, line 95
Deprecated since v2017.09.455.g.2.fba.0.ba.0.d, will be removed with release v2018.01!
Please use :out-buffer argument to control handle buffering instead.
--------------------------------------------------------------------------------
Please contact the author to have these occurrences of deprecated code
adapted, so that this message will disappear!
#!/bin/sh
# du.sh -- find usage of an s3 bucket and directory (recursively)
#
# Usage:
#
# du.sh <bucket> <directory>
#
# requires jq, perl, aws-cli
[Event "GameKnot Blitz"]
[Site "http://gameknot.com/"]
[Date "2018.03.07"]
[Round "-"]
[White "makokha"]
[Black "jayvee101"]
[Result "1-0"]
1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 Bb4 6. Bd3 d5 7. e5 Ne4 8. O-O Nxc3 9. bxc3 Bxc3 10. Ba3 Bxd4 11. Bb5+ Nc6 12. Qxd4 Bd7 13. Bxc6 Bxc6 14. Qg4 g6 15. Rab1 Rc8 16. c4 Qa5 17. Bd6 Rd8 18. cxd5 Bxd5 19. Rfc1 Rxd6 20. exd6 Bc6 21. d7+ Bxd7 22. Rxb7 Ke7 23. Rxd7+ Kxd7 24. Qd4+ Qd5 25. Qxh8 1-0
$ cat unique.js
#!/usr/bin/env node
talks = [
{ 'id' : 1, name : 'foo' },
{ 'id' : 2, name : 'foo' },
{ 'id' : 3, name : 'bar1' },
{ 'id' : 3, name : 'bar2' },
{ 'id' : 4, name : 'bar3' },
{ 'id' : 5, name : 'bar4' }
[Event "Casual Game"]
[Site "Butcher Bar"]
[Date "2018.05.09"]
[White "Timur"]
[Black "Brian"]
[Result "0-1"]
1. e4 d5 2. Nf3 dxe4 3. Ng5 Nf6 4. Bc4 e6 5. f3 Bc5 6. fxe4 Qd4 7. Nh3 Qxc4 8.
b3 Qd4 9. Nc3 Nxe4 10. Qg4 Nxc3 11. Qxd4 Bxd4 12. dxc3 Bxc3+ 13. Bd2 Bxa1 14.
O-O Bd4+ 15. Kh1 Nc6 16. Ng5 O-O 17. c3 e5 18. cxd4 Nxd4 19. Bb4 Rd8 20. Nxf7