Skip to content

Instantly share code, notes, and snippets.

View perforb's full-sized avatar

Yusuke Maeda perforb

View GitHub Profile
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
use constant LENGTH => 10;
my ($n, $min, $max) = (shift @ARGV || 8, 0, 0);
my @positions = ();
push @positions, int(rand(LENGTH + 1)) for (1 .. $n);
for my $position (@positions) {
@perforb
perforb / gist:2719493
Created May 17, 2012 14:59
Concatenate elisp files in the current directory
# Concatenate elisp files in the current directory
for f in $(ls | grep -E 'el$'); do $(cat $f >> concat.el); $(echo -e "\n" >> concat.el); done
@perforb
perforb / blackjack.pl
Created February 29, 2012 17:26
Console game
#!/usr/bin/env perl
use 5.12.0;
use warnings;
use List::Util qw/shuffle/;
use constant {
P => 'Player',
D => 'Dealer',
};
@perforb
perforb / div.pl
Created February 27, 2012 15:49
It sprits a character string in N characters.
#!/usr/bin/env perl
use 5.12.0;
use warnings;
# It sprits a character string in N characters.
my @alphabets = join('', 'a' .. 'y') =~ m/.{1,3}/g;
say join ',', @alphabets;
# >> abc,def,ghi,jkl,mno,pqr,stu,vwx,y