Skip to content

Instantly share code, notes, and snippets.

@hiroaki
hiroaki / W3CDTF.pl
Created August 7, 2014 16:04
sample of W3CDTF in Perl
use DateTime::Format::W3CDTF;
my $dt_string = $ARGV[0];
my $w3cdtf = DateTime::Format::W3CDTF->new;
my $dt = $w3cdtf->parse_datetime($dt_string);
print $dt->epoch, "\n";
@hiroaki
hiroaki / install-shared-mime-info.sh
Created December 27, 2014 11:47
This script installs "shared-mime-info" on OS X Yosemite.
#!/bin/sh
# This script installs "shared-mime-info" to OS X Yosemite.
#
# Usage:
#
# $ sh this-script.sh [install-prefix]
#
# There is no need for you to modify the following.
@hiroaki
hiroaki / new_gist_file.rb
Created December 29, 2014 07:25
Get empty port
require 'socket'
class Util
def self.empty_port
s = TCPServer.open(0)
port = s.addr[1]
s.close
port
end
end
@hiroaki
hiroaki / publish-dir.pl
Last active August 29, 2015 14:25
Publish directory via HTTP using plack
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Std;
my $opts = {
s => 'Standalone',
h => '0.0.0.0',
p => 5000,
@hiroaki
hiroaki / checksum-sha1.sh
Created July 18, 2015 16:50
Check SHA-1 digest
#!/bin/sh
exec -- openssl dgst -sha1 $1
@hiroaki
hiroaki / zweitegps-json2gpx.rb
Created August 22, 2015 07:22
convert the data format of ZweiteGPS
#!/usr/bin/env ruby
# NOTE: currently, convert "trk" only. this does not consider "wpt" and "rte" yet.
require 'json'
require 'rexml/document'
require 'time'
json_file = ARGV[0]
@hiroaki
hiroaki / bin_myapp.pl
Created December 21, 2011 14:42
A small framework for executing the command for a maintenance etc. under the same environment as Web (Mojolicious)
#!/usr/bin/env perl
use strict;
use warnings;
use feature ':5.10';
use Encode::Argv;
use File::Basename 'dirname';
use File::Spec;
@hiroaki
hiroaki / is_embeddable.pl
Created January 2, 2012 03:33
This program checks whether an image is able to be embedded by AtomicParsley.
#!/usr/bin/env perl
=pod
This program checks whether an image is able to be embedded by AtomicParsley.
=cut
use strict;
use warnings;
@hiroaki
hiroaki / gist:1893896
Created February 23, 2012 17:23
A sample of streaming by Mojolicious
#!/usr/bin/env perl
=pod
A sample of streaming.
This sends dynamic contents on "Transfer-Encoding: chunked".
See also the source: t/mojolicious/longpolling_lite_app.t
=cut
@hiroaki
hiroaki / plist2gpx.pl
Created February 27, 2012 14:46
This converts plist which was printed out by KingGPS into GPX
#!/usr/bin/env perl
use 5.12.0;
use warnings;
use Geo::Gpx;
use Getopt::Std;
use Mac::PropertyList;
#-- setting
my $options = {};