Skip to content

Instantly share code, notes, and snippets.

@tokubass
tokubass / twitter_ril.pl
Created June 12, 2011 10:13 — forked from norry-gogo/twitter_ril.pl
Twitter API -> Read it later API
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Net::Twitter;
use URI::Find;
use Web::Scraper;
use LWP::UserAgent;
use YAML;
@tokubass
tokubass / gist:1476400
Created December 14, 2011 12:32
rubi is removed from aozora.gr.jp
#!/usr/bin/env perl
use strict;
use utf8;
use File::Basename;
for my $argv (@ARGV){
my $file_name = basename($argv,'.txt');
open my $fh_in, "<:encoding(shiftjis)", $argv or die "$argv : $!";
@tokubass
tokubass / js_oop_sample.js
Created February 19, 2012 21:46 — forked from karupanerura/js_oop_sample.js
flatten_callback
"use strict";
var FuncFlatten = function () {
var codeList = [].slice.apply(arguments);
return {
add: function () {
[].push.apply( codeList, [].slice.apply(arguments) );
},
run: function () {
var runner = new FuncFlattenRunner();
@tokubass
tokubass / my_uri.pl
Created August 25, 2012 21:03
Perl Beginners #4
#!/usr/bin/env perl
use strict;
use Data::Dumper;
my $strobj = MyURI::http->new({ str => 'http://hoge/'});
warn Dumper $strobj;
warn $strobj;
package MyURI {
use overload (
@tokubass
tokubass / non_overlap.pl
Created October 17, 2012 04:39 — forked from umeyuki/non_overlap.pl
同じ組み合わせのサイズは追加しないスクリプト
use strict;
use warnings;
use Data::Dumper;
my @banner_size = ({
width => 320,
height => 50,
});
my $is_existing_size;
@tokubass
tokubass / install_Ricty.sh
Created January 2, 2013 17:12
install Ricty font to max os x 10.8.2
#!/bin/sh
# 前提条件
# 1.fontforgeとx11をインストール済み
# sudo port install fontforge
# x11 http://xquartz.macosforge.org/landing/
#
# 2.同一ディレクトリにRicty-***.
@tokubass
tokubass / Project Euler - Problem 3
Last active December 11, 2015 09:39
use bigintのテスト。Math::BigIntに変換してくれている。
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use bigint lib => 'GMP';
use Test::More;
subtest 'Project Euler - Problem 3' => sub {
my $n = 6008514751430000000000000000000000000000000000000000000000000000;
@tokubass
tokubass / replace_case_sensitive.pl
Last active December 12, 2015 09:08
twitterで見かけたつぶやきに対して。 先頭大文字、全部大文字、全部小文字の3パターンだけに仕様縮小。 もっと短く書きたいなぁ。 ver3
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
my $str = 'foo Foo FOO';
$str =~ s{(foo)}{ my $len = scalar split(/[A-Z]/,$1); ( $len == 0 ) ? 'BAR' : ( $len == 1 ) ? 'bar' : 'Bar' }ieg;
is($str, 'bar Bar BAR');
@tokubass
tokubass / xslate_adjust_line_number.pl
Last active December 14, 2015 18:28
xslate行数調整
#!/usr/bin/env perl
use strict;
use warnings;
use Text::Xslate;
use IO::All;
my $tx = Text::Xslate->new(
syntax => 'TTerse',
verbose => 2,
#!/usr/bin/env perl
use strict;
use warnings;
use IPC::Run qw/ timeout /;
IPC::Run::run(
['cat', 'sample.txt'],
\my $in,
\my $out,
\my $err,