Skip to content

Instantly share code, notes, and snippets.

View riywo's full-sized avatar
🏈
Go 49ers!

Ryosuke Iwanaga riywo

🏈
Go 49ers!
View GitHub Profile
<main class="content" role="main">
<article class="post post-section {{ .Section }}">
{{ range .Data.Pages.GroupByDate "Jan 2006" }}
<h3>{{ .Key }}</h3>
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
aws_s3_sync = "aws --region us-west-2 s3 sync public s3://blog.riywo.com --delete --storage-class=REDUCED_REDUNDANCY"
task :default => :server
task :server do
sh 'rm -fr public'
exec 'hugo server -b http://blog.riywo.com --appendPort=false -w --disableLiveReload'
end
task :test do
sh %Q{#{aws_s3_sync} --dryrun --size-only}
<VirtualHost *>
ServerName blog.riywo.com
ProxyPreserveHost On
ProxyRequests off
<Proxy balancer://blog>
BalancerMember http://localhost:1313
BalancerMember http://blog.riywo.com.s3-website-us-west-2.amazonaws.com status=+H
</Proxy>
ProxyPass / balancer://blog/
</VirtualHost>
@riywo
riywo / gist:725640
Created December 2, 2010 16:45
easy QueryComment(where the query executed)
my $dbh = DBI->connect('dbi:mysql:test','test','test', {
RaiseError => 1,
Callbacks => {
ChildCallbacks => {
execute => sub {
my ($obj, @binds) = @_;
my ($package, $file, $line) = caller;
$obj->{Database}->{Statement} .= "/* $package:$file:$line */";
return;
},
#!/usr/bin/perl
use strict;
use warnings;
exit if(@ARGV != 2);
my $file1 = $ARGV[0];
my $file2 = $ARGV[1];
my %data1;
source('Rworker.r')
file <- rworker_download(args$data)
rworker_log(paste("Download finished:", file))
d <- read.csv(file, header = T)
rworker_log("read.csv finished:")
png(args$img)
plot(d)
speed dist
4 2
4 10
7 4
7 22
8 16
9 10
10 18
10 26
10 34
# ifstat -b -t -i bond0,eth0,eth1 1 5
Time bond0 eth0 eth1
HH:MM:SS Kbps in Kbps out Kbps in Kbps out Kbps in Kbps out
18:46:33 11248.00 19186.19 11166.92 19186.19 81.08 0.00
18:46:34 10672.05 17935.01 10589.01 17935.01 83.04 0.00
18:46:35 10908.38 21413.09 10837.35 21413.09 71.03 0.00
18:46:36 10786.80 18413.89 10739.27 18413.89 47.53 0.00
18:46:37 11408.11 18082.65 11339.09 18082.65 69.02 0.00
@riywo
riywo / gist:836630
Created February 21, 2011 03:41
指定秒間だけtcpdumpしてmk-query-digestするshell
#!/bin/sh
SEC=$1
tcpdump -s 65535 -nn -q -tttt -x port 3306 -l > /tmp/tcpdump.3306 2> /dev/null &
PID_3306=$!
tcpdump -s 65535 -nn -q -tttt -x port 11211 -l > /tmp/tcpdump.11211 2> /dev/null &
PID_11211=$!
@riywo
riywo / gist:836641
Created February 21, 2011 04:00
mk-slave-delay使って開発環境のslaveDBを3秒意図的に遅延させるdaemontools shell
#!/bin/sh
exec mk-slave-delay --delay 3s --interval 1s h=localhost,u=root,p=password &>/dev/null