Skip to content

Instantly share code, notes, and snippets.

View fujiwara's full-sized avatar

FUJIWARA Shunichiro fujiwara

View GitHub Profile
<html>
<body>
<script src="test.js"></script>
</body>
</html>
tweet "\u2028 \u2029 これかなあ"
json "\ \ \u3053\u308c\u304b\u306a\u3042"
これでJSONのパースエラーになる
@fujiwara
fujiwara / gist:732822
Created December 8, 2010 03:02
mt.psgi
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
use Plack::Builder;
use Plack::App::CGIBin;
my $basedir = dirname(__FILE__);
package Acme::AutoInstall;
use strict;
use warnings;
my $first;
my @orig_argv;
BEGIN {
$first = 1;
@orig_argv = @ARGV;
};
#!/usr/bin/perl
# -*- coding:utf-8 -*-
use strict;
my $SVNLOOK='/usr/bin/svnlook';
sub main {
my ( $repos, $txn ) = @_;
my @log_cmd = ( $SVNLOOK, 'log', "-t$txn", $repos );
open my $pipe, '-|', @log_cmd or die $!;
use strict;
use warnings;
use Fcntl qw/ :DEFAULT :flock :seek /;
open my $fh, "+<", "a.txt";
flock $fh, LOCK_EX;
my $data = <$fh>;
truncate $fh, 0;
seek $fh, 0, SEEK_SET;
print $fh "abc";
#!/usr/bin/env perl
use strict;
use warnings;
use Plack::Builder;
use AnyEvent;
use Cache::LRU;
use Sys::Virt;
use JSON;
use Data::Section::Simple qw/ get_data_section /;
use strict;
use Regexp::Log::Common;
use Data::Dumper;
{
# combined の末尾にフィールド追加
$Regexp::Log::Common::FORMAT{":more_extended"}
= $Regexp::Log::Common::FORMAT{":extended"} . ' %more';
# 追加したフィールドにマッチする正規表現
$Regexp::Log::Common::REGEXP{'%more'} = '(?#=more)\w+(?#!more)';
# virt-install --connect qemu:///system --name=test --ram=512\
--file=/dev/VolGroup00/test --vcpus=1\
--os-variant=virtio26 --nographics --accelerate\
--hvm --extra-args='ks=http://192.168.122.1:5000/ console=tty0 console=ttyS0,115200n8'\
--location="http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.5/os/x86_64/"
@fujiwara
fujiwara / sl6.ks
Created May 4, 2011 14:17
sl6 kickstart
# virt-install --name sl6 --ram 1024 --disk /var/tmp/sl62.img \
--location http://ftp.jaist.ac.jp/pub/Linux/scientific/6/x86_64/os/ \
--nographics --hvm --os-variant=virtio26 --network bridge=br0 \
--os-type=linux --keymap ja \
--extra-args='ks=http://example.com/sl6.ks console=tty0 console=ttyS0,115200n8'