Skip to content

Instantly share code, notes, and snippets.

@niratama
niratama / MySub.pm
Created February 19, 2015 06:40
呼び出し元のサブルーチンを呼び出す
package MySub;
use strict;
use warnings;
use MySub2;
sub callback {
print "in MySub::callback($_[0])\n";
}
@niratama
niratama / gist:39409a3992d341bc2359
Created February 6, 2015 17:58
goで正規表現を使ってstructにparseする実験
package main
import (
"fmt"
"reflect"
"time"
"strconv"
"regexp"
)
@niratama
niratama / twpicdl.sh
Last active November 26, 2019 11:46 — forked from marbocub/twpicdl.sh
#!/bin/sh
# Modified by Stan Schwertly to download locally rather than to send to Posterous.
# Github: http://github.com/Stantheman/Twitpic-Backup
# Copyright 2010 Tim "burndive" of http://burndive.blogspot.com/
# This software is licensed under the Creative Commons GNU GPL version 2.0 or later.
# License informattion: http://creativecommons.org/licenses/GPL/2.0/
# This script is a derivative of the original, obtained from here:
@niratama
niratama / open-golang-test.go
Created August 24, 2014 06:39
goでhttpサーバ起動と同時にブラウザを開く例
package main
import (
"fmt"
"log"
"net/http"
"github.com/skratchdot/open-golang/open"
)
@niratama
niratama / gist:b6f71d45e7cb2c09b1d1
Created August 12, 2014 12:02
hikarie.go #2最後のお題
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strconv"
)
use utf8;
use strict;
use warnings;
use Encode qw(encode_utf8 decode_utf8);
# 文字が指定のバイト数を超えている場合に切り取る。
sub kirisute_gomen {
my ($string, $byte_len, $str_len) = @_;
return $string if (length(encode_utf8($string)) <= $byte_len && length($string) <= $str_len);
@niratama
niratama / futapo.user.js
Last active August 29, 2015 13:56
futaPoのサムネイルを拡大するuserscript
// ==UserScript==
// @name futaPoサムネイル拡大
// @namespace http://nira.poi.jp/userscript/futapo.user.js
// @version 0.0.3
// @description futaPoのサムネイルを拡大します
// @includes http://futakuro.com/futapo/*
// @excludes
// ==/UserScript==
//
(function (callback) {
@niratama
niratama / test.xml
Created December 19, 2013 11:12
FirefoxとIE/Safari/Chromeで挙動の違うXSLT
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<article title="hello!">
<content><![CDATA[
<div style="text-align: center;">Hello, world!</div>
]]></content>
</article>
@niratama
niratama / myapp.pl
Created December 10, 2013 13:50
Mojoliciousで各種ストリーミングのテスト
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $self = shift;
$self->render('index');
};
# XMLHttpRequest Streaming
get '/stream' => sub {
@niratama
niratama / gist:7214083
Created October 29, 2013 12:52
perl-Net-HandlerSocketのやっつけパッチ
diff --git a/perl-Net-HandlerSocket/HandlerSocket.xs b/perl-Net-HandlerSocket/HandlerSocket.xs
index d0aaaa3..67baf8c 100644
--- a/perl-Net-HandlerSocket/HandlerSocket.xs
+++ b/perl-Net-HandlerSocket/HandlerSocket.xs
@@ -522,7 +522,8 @@ execute_multi(obj, cmds)
CODE:
DBG(fprintf(stderr, "execute_multi0\n"));
const I32 cmdsmax = av_len(cmds);
- execute_arg args[cmdsmax + 1]; /* GNU */
+// execute_arg args[cmdsmax + 1]; /* GNU */