Skip to content

Instantly share code, notes, and snippets.

View comewalk's full-sized avatar

Takatsugu Shigeta comewalk

View GitHub Profile
@comewalk
comewalk / write_htaccess.pl
Created February 22, 2010 15:56
write htaccess for my blog
#!/usr/bin/perl
use strict;
use warnings;
use File::Find::Rule ();
use Perl6::Say;
say 'RewriteEngine on';
@comewalk
comewalk / ipv6_benchmark.pl
Created September 27, 2010 16:46
compared NetAddr::IP with Net::IP
#!/usr/bin/perl
use strict;
use warnings;
use Net::IP;
use NetAddr::IP;
use Benchmark ':all';
cmpthese(timethese(1000, {
@comewalk
comewalk / extractzip.vbs
Created January 19, 2011 16:30
extract all zip files in the directory
Set objShell = CreateObject("Shell.Application")
Set objWshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(objWshShell.CurrentDirectory)
Set files = folder.Files
For each folderIdx In files
ZipFile=folderIdx.Name
ExtName = LCase(fso.GetExtensionName(folderIdx.Name))
If ExtName = "zip" Then
@comewalk
comewalk / upload2livedoor.pl
Created February 19, 2011 07:54
upload a jpeg file to livedoor blog via atompub. but I'm getting 400 though. hmm :(
#!/usr/bin/perl
=head1 NAME
upload2livedoor - upload a jpeg file to livedoor blog via atompub
=head1 SYNOPSIS
upload2livedoor.pl [userid] [apikey] [filename]
@comewalk
comewalk / download_metalheadz_podcast.sh
Created March 29, 2011 11:27
download an enclosure from metalheadz podcast
#!/bin/sh
curl -L http://www.metalheadz.co.uk/podcast/podcast2010.xml -o metalheadz.podcast2010.xml
grep -nr enclosure metalheadz.podcast2010.xml | perl -nle '($url = $_) =~ s/^.*url="([^"]+)".*$/$1/g; print $url' | head -n 1 | awk '{print "curl -O "$1}' | sh -
@comewalk
comewalk / gist:1000833
Created May 31, 2011 16:35
Extract Evernote API SDK
$ mkdir evernote
$ cd evernote/
$ curl -L -O http://evernote.s3.amazonaws.com/api/evernote-api-1.19.zip
$ unzip evernote-api-1.19.zip
$ cd evernote-api-1.19/
$ ls sample/
android csharp java javame php python ruby
@comewalk
comewalk / sharing_files.psgi
Created December 15, 2011 06:25
Sharing files
#!/usr/bin/env perl
use strict;
use warnings;
use Plack::Builder;
use Plack::App::Directory;
builder {
Plack::App::Directory->new({root => "/path/to"})->to_app;
@comewalk
comewalk / parse_sitemaps.py
Created June 28, 2012 16:23
Parse sitemaps.xml for urls
#!/usr/bin/env python
from xml.etree import ElementTree
def main():
namespace = 'http://www.google.com/schemas/sitemap/0.84'
xml = ElementTree.parse('./sitemap.xml')
root = xml.getroot()
for item in root.findall('.//s:loc', namespaces=dict(s=namespace)):
print item.text
@comewalk
comewalk / gist:3337283
Created August 13, 2012 06:00
create a new event via calendar api
# Create a new event
say '=== Create a new event ===';
my $new_event = {
'summary' => '宇宙兄弟',
'location' => '日本テレビ',
'start' => {
'dateTime' => '2012-08-12T07:00:00+09:00',
},
'end' => {
'dateTime' => '2012-08-12T07:30:00+09:00',
@comewalk
comewalk / dfareporting.pl
Created August 29, 2012 16:42
DFA Reporting API sample. Although I don't know that this script gets right results. Because I don't have my DFA account.
#!/usr/env/perl
use strict;
use warnings;
use feature qw/say/;
use FindBin;
use Google::API::Client;
use OAuth2::Client;