This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# cat access.log | ruby parse.rb | |
# if --since is given, logs before the specified time are ignored | |
# (by string comparison) | |
# eg. --since='2013-11-05T02:23' | |
# supported accesslog format : http://i2bskn.hateblo.jp/entry/2013/05/14/003726 style | |
# | |
# log_format ltsv "time:$time_iso8601" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Acme::2zicon; | |
my $nizicon = Acme::2zicon->new; | |
my @members = $nizicon->sort('age', 1); | |
for my $member (@members) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"nick" : [ | |
"ななぴ" | |
], | |
"name" : "西七海", | |
"introduction" : "わたしはあまーいチョコレート。あなたの熱気で溶けちゃうの。\n虹コン色黒担当、東京都出身18歳\nななぴこと西七海です。", | |
"hometown" : "東京都", | |
"name_en" : "Nanami Nishi", | |
"twitter" : "nishi_nanami", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Acme::2zicon; | |
my $nizicon = Acme::2zicon->new; | |
my @members = $nizicon->sort('age', 1); | |
for my $member (@members) { | |
print $member->name_ja." ".$member->age. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var port = flag.Uint("port", 8080, "port to listen") | |
var fd = flag.Uint("fd", 0, "fd to listen and serve") | |
func init() { | |
flag.Parse() | |
} | |
func main() { | |
sigchan := make(chan os.Signal) | |
signal.Notify(sigchan, syscall.SIGTERM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
error_reporting(-1); | |
ini_set('display_errors', true); | |
$OK = 0; | |
$WARNING = 1; | |
$CRITICAL = 2; | |
$UNKNOWN = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.jQuery || document.write('<script src="/js/jquery.min.js"><\/script>'); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin | |
NAME=unicorn | |
RAILS_ENV=${RAILS_ENV:-production} | |
APP=application_name | |
EX_USER=www-data | |
ROOT_DIR="/home/$USER/$APP/current" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ruby-prof' | |
RubyProf.start | |
# code... | |
results = RubyProf.stop | |
# Print a flat profile to text | |
File.open "#{Rails.root}/tmp/performance/#{file_name}-graph.html", 'w' do |file| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
my $sum = 0; | |
while(<>) { | |
if(m/\A# Query_time: ([0-9.]+)/){ | |
$sum = $sum + $1; | |
} | |
} |