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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"strings" | |
"log" | |
) | |
func main() { |
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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"strings" | |
"log" | |
"flag" | |
) |
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
-module(t). | |
-export([chop/2]). | |
chop(Key, List) -> | |
chop(Key, List, 0). | |
chop(Key, List, Acc) -> | |
Mid = length(List) div 2, | |
{List1, List2} = lists:split(Mid, List), | |
%io:format("List1> ~p~nList2> ~p~n Mid> ~p~n Acc> ~p~n", [List1, List2, Mid, Acc]), |
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
-module(fizzbuzz). | |
-export([t/0, t/1]). | |
t() -> | |
t(100). | |
t(Limit) when Limit > 0 -> | |
fizzbuzz(lists:seq(1, Limit)); |
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 -MMojo::UserAgent -MFile::Path=make_path -C -S -E 'my $ua=Mojo::UserAgent->new; chomp(my $date=`date +%Y%m%d`); my $path=$ENV{HOME} . "/Dropbox/tunes.io/$date"; make_path( $path ); $ua->get("http://tunes.io")->res->dom->html->body->div->ul->find('a')->each( sub { say "Getting " . $_->text; $ua->max_redirects(5)->get($_->{href})->res->content->asset->move_to($path."/".$_->text().".mp3") } )' |
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 -C -S -MTime::Piece -Mojo -E '$i=1; mkdir $dir=$ENV{HOME}."/Dropbox/tunes.io/".localtime->ymd; say $_->text and g($_->attrs("href"))->max_message_size(25600000)->content->asset->move_to("$dir/${\$i++} ${\$_->text}.mp3") for g("tunes.io")->dom("ul a")->each' |
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
use 5.014; | |
use strict; | |
use warnings; | |
use Text::Summarize::En; | |
use Data::Dump qw(dump); | |
my $summarizerEn = Text::Summarize::En->new(); | |
my $text =<<_EOF; | |
Ok, | |
there's no way to do this gracefully, so I won't even try. I'm going to | |
just hunker down for some really impressive extended flaming, and my |
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
-module(base62). | |
-export([encode62/1, decode/1, encode36/1]). | |
%% can call it as: | |
%% | |
%% base62:encode62(crypto:rand_bytes(8)). | |
nthchar(N) when N =< 9 -> $0 + N; | |
nthchar(N) when N =< 35 -> $A + N - 10; | |
nthchar(N) -> $a + N - 36. |
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
use 5.016; | |
package Example { | |
use Moo; | |
use MooX::Types::MooseLike::Base qw(Int Str); | |
has 'foo' => ( is => 'ro', isa => Str, default => sub { 'bar' } ); | |
has 'qux' => ( is => 'ro', isa => Int, default => sub { 123 } ); | |
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
use 5.010; | |
my $user = 'root'; | |
my $pass = 'pass'; | |
my $host = '10.1.2.3'; | |
my $port = '3306'; | |
my %names = ( | |
pool1 => 'db_foo', | |
pool2 => 'db_bar', |