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 / AtomicParsley.cpp.patch
Created July 27, 2013 15:44
This is a patch for AtomicParsley (v0.9.0). Because there is a problem when building on GCC 4.4, such as "error: invalid conversion from 'const char*' to 'char*'".
--- AtomicParsley.cpp.orig 2006-09-16 08:22:33.000000000 +0900
+++ AtomicParsley.cpp 2013-07-27 17:18:30.279141101 +0900
@@ -1447,7 +1447,7 @@
uint32_t atom_offsets = 0;
char* uuid_outfile = (char*)calloc(1, sizeof(char)*MAXPATHLEN+1); //malloc a new string because it may be a cli arg for a specific output path
if (output_path == NULL) {
- char* orig_suffix = strrchr(originating_file, '.');
+ const char* orig_suffix = strrchr(originating_file, '.');
if (orig_suffix == NULL) {
fprintf(stdout, "AP warning: a file extension for the input file was not found.\n\tGlobbing onto original filename...\n");
@hiroaki
hiroaki / beanstalk_client.pl
Last active December 16, 2015 11:49
(prototype) asynchronous client of beanstalk that performs as producer or multi process worker daemon.
#!/usr/bin/env perl
use 5.12.0;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use AnyEvent::Beanstalk;
use Data::Dumper;
use MyApp::App::Command;
@hiroaki
hiroaki / flatten-multipart.pl
Created March 4, 2013 14:18
Each MIME part which may be nested will be arranged in an array.
=head1 NAME
flatten-multipart.pl - flatten multipart message
=head1 SYNOPSIS
$ perl flatten-multipart.pl email.eml
multipart/mixed (2)
multipart/related (2)
application/octetstream (142019)
@hiroaki
hiroaki / viewer.html
Created May 21, 2012 16:51
Overlay GPX on the Google Maps
<!DOCTYPE html>
<html><head><title>GPX Casual Viewer v3</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-style-type" content="text/css" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
@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 = {};
@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 / 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 / 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;