Skip to content

Instantly share code, notes, and snippets.

View keiya's full-sized avatar

keiya keiya

View GitHub Profile
@keiya
keiya / index.html
Created February 12, 2012 16:53
physical simulator on dom
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>phyjics</title>
<meta name="viewport" content="initial-scale=0.9, minimum-scale=0.9, maximum-scale=1.1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<script src="http://cdn.keiyac.org/common/jquery/jquery.min.js" type="text/javascript"></script>
@keiya
keiya / akb_members.pl
Created February 29, 2012 10:59
csv of akb48 members
#!/usr/bin/perl
#
# by Keiya Chinen
use strict;
use Web::Scraper;
use URI;
use Data::Dumper;
use utf8;
@keiya
keiya / ec2script.sh
Created April 10, 2012 22:22 — forked from Problematic/ec2script.sh
Amazon EC2 Setup Script
#!/bin/bash
# Script for quick configuration of an EC2 Server
# Installs the necessaries for most PHP Jobs
# Run as Root or suffer the consequences of stuff telling you it can't get a lock and whatnot
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
cd /etc/yum.repos.d
#!/usr/bin/perl
#
# by Keiya Chinen
use strict;
use warnings;
use utf8;
use LWP;
#!/usr/bin/perl
#
# by Keiya Chinen
# usage:
# perl animedl.pl http://www.anime44.com/the-melancholy-of-haruhi-suzumiya-season-2-episode-8
use strict;
use warnings;
use utf8;
@keiya
keiya / batch.sh
Created May 24, 2012 08:24
シェルスクリプト排他処理のサンプル
#!/bin/sh
cd /var/www/html/application/batch_scripts
LOGDIR=batch_logs
LOCKFILE=$LOGDIR/lock
trap "echo Trapped; rm -f $LOCKFILE; exit" INT QUIT TERM
# ロックファイルがあれば60秒*最大3回待機、1日前のロックファイルなら無視
@keiya
keiya / README
Created May 24, 2012 16:01
Perl Multithread & Multiprocess Socket Program
サーバ:マルチプロセスモデルのEchoサーバ、1プロセス1クライアント。
クライアント:マルチスレッド(threads)のクライアント
(標準入力に1スレッド,受信(と標準出力)に1スレッド,送信に1スレッドで、情報はキューで受け渡し)
クライアントの方はなぜかシグナルハンドラがゴミでシグナルが無視される。
いちばん手間かかったのがtty周りという。stty rawとかしてる。cursesとかつかえば簡単なんだろうけど。
でもこれでssh/telnetもどきができる土俵は整ったかな。
@keiya
keiya / image_filter_test.php
Created May 29, 2012 07:59
ImageMagick Filters Test
<?php
/* image_filter_test.php
* by Keiya Chinen
*
* https://gist.github.com/2823192
*
* (MIT Licence)
* 汚いコードだなぁ
*
@keiya
keiya / watchdog.pl
Created July 16, 2012 04:35
Process watchdog script
#!/usr/bin/perl --
# process watchdog script
# Keiya Chinen <[email protected]>
use strict;
use warnings;
$| = 1;
@keiya
keiya / fnavi-scrape.pl
Created July 26, 2012 08:33
f-navigation.jp scraping script
#!/usr/bin/perl
#
# by Keiya Chinen
use strict;
use Web::Scraper;
use URI;
use Data::Dumper;
use Time::Piece;