Skip to content

Instantly share code, notes, and snippets.

View oklahomer's full-sized avatar
🏠
Working from home

Go HAGIWARA / 萩原 豪 oklahomer

🏠
Working from home
View GitHub Profile
@oklahomer
oklahomer / benchmark_sort_maker.pl
Created February 16, 2014 05:19
benchmarked each sort style provided by Sort::Maker for my specific purpose
#!/usr/bin/env perl
use strict;
use warnings;
use Sort::Maker qw/make_sorter/;
use Benchmark qw/:all/;
warn "Perl: $]\n";
warn "Sort::Maker: $Sort::Maker::VERSION\n\n";
#Perl: 5.018001
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Modern::Perl;
use Benchmark qw(cmpthese);
use DateTime;
use DateTime::Format::Strptime;
use Time::Piece qw(localtime);
use POSIX qw(floor strftime);
sub lookup_cached_image {
my ($class, $input) = @_;
# with Devel::Size, it appears that teng row object size is much bigger
# than the actual data it contains.
# so it just caches column values, here.
my $column_data = c->cache->get_or_set(
$cache_key => sub {
my $row = c->db->single(campaign_image => +{
id => $input->{id},
@@ -12,7 +12,7 @@ use Digest::SHA qw(hmac_sha256 hmac_sha256_hex);
use MIME::Base64::URLSafe qw(urlsafe_b64decode);
use Scalar::Util qw(blessed);
-our $VERSION = '1.12';
+our $VERSION = '1.13';
sub new {
my $class = shift;
@@ -97,21 +97,38 @@ sub parse_signed_request {
#!/usr/bin/env perl
use strict;
use warnings;
use v5.10;
use Facebook::OpenGraph;
my $fb = Facebook::OpenGraph->new;
my $res = $fb->request('GET', 'go.hagiwara');
say 'etag : ' . $res->etag;
say 'x-fb-rev : ' . $res->header('x-fb-rev');
#!/usr/bin/env perl
# It repros the problem reported here: http://stackoverflow.com/questions/23355011/is-it-possible-to-delete-facebook-video-via-graph-api
use strict;
use warnings;
use Facebook::OpenGraph;
my $fb = Facebook::OpenGraph->new(+{
app_id => 'APP_ID',
@oklahomer
oklahomer / gist:d21ce616ba85bdfc6a20
Created May 5, 2014 05:29
Error on plenv install-cpanm
% plenv install-cpanm
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
113 226 113 226 0 0 144 0 0:00:01 0:00:01 --:--:-- 144
Bareword found where operator expected at - line 3, near "400 Bad"
(Missing operator before Bad?)
Bareword found where operator expected at - line 6, near "<p>Your"
(Missing operator before Your?)
syntax error at - line 2, near "html>"
Execution of - aborted due to compilation errors.
% curl --version
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
#!/usr/bin/env perl
use strict;
use warnings;
use Facebook::OpenGraph;
use Data::Dumper;
{
my $fb = Facebook::OpenGraph->new(+{
app_id => $ENV{OLD_APP_ID},
secret => $ENV{OLD_SECRET},
@oklahomer
oklahomer / cgps.txt
Created July 10, 2014 12:28
finally 'cgps -s' returns fixed data
┌───────────────────────────────────────────┐┌─────────────────────────────────┐
│ Time: 2014-07-10T12:26:33.000Z ││PRN: Elev: Azim: SNR: Used: │
│ Latitude: XX.XXXXXX N ││ 193 84 327 28 Y │
│ Longitude: XXX.XXXXXX E ││ 4 67 049 30 Y │
│ Altitude: XX.X ft ││ 6 61 335 40 Y │
│ Speed: 0.3 mph ││ 10 59 261 21 Y │
│ Heading: 7.5 deg (true) ││ 13 50 096 00 Y │
│ Climb: 0.0 ft/min ││ 2 30 303 36 N │
│ Status: 3D FIX (6 secs) ││ 12 14 300 36 N │
│ Longitude Err: +/- 59 ft ││ 38 00 000 00 N │