Skip to content

Instantly share code, notes, and snippets.

Tatsuru WATANABE tatsuru

Block or report user

Report or block tatsuru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:70437490e1fb1bb0c7df
#!/usr/bin/env ruby
require 'json'
def parse(uri)
JSON.parse `curl #{uri}`.gsub("/*\n * This file is intended for use only on aws.amazon.com. We do not guarantee its availability or accuracy.\n *\n * Copyright 2014 Amazon.com, Inc. or its affiliates. All rights reserved.\n */\ncallback({",'{').gsub("\);", '').gsub(/([a-zA-Z]+):/, '"\1":')
end
table = {
:light => parse('http://a0.awsstatic.com/pricing/1/ec2/previous-generation/light_linux.min.js'),
View app.psgi
use Plack::Builder;
my $app = sub {
return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];
};
builder {
enable "ServerStatus::Lite", path => '/server-status', allow => ['127.0.0.1'], scoreboard => '/dev/shm/server-status', counter_file => '/tmp/counter_file';
$app;
};
@tatsuru
tatsuru / Dockerfile
Created Apr 16, 2014
ikachan dockerfile
View Dockerfile
# Ikachan Dockerfile
FROM tatsuru/debian
RUN apt-get update
RUN apt-get install -y build-essential curl libssl-dev
RUN curl -s https://raw.githubusercontent.com/tagomoris/xbuild/master/perl-install > /tmp/perl-install
RUN bash /tmp/perl-install 5.18.2 /opt/perl-5.18
View gist:8837289
%type 通知の種類
%sname 相手の名前
%fname ファイル名
%fpath ファイルのパス?
%smessage メッセージ
%fsize ファイルサイズ
%sskype ?
@tatsuru
tatsuru / gist:8518036
Created Jan 20, 2014
tmux status line
View gist:8518036
set -g status-right "#W [#(cat /sys/class/power_supply/BAT0/status | cut -c-1)#(cat /sys/class/power_supply/BAT0/capacity)][#(cat /sys/class/power_supply/BAT1/status | cut -c-1)#(cat /sys/class/power_supply/BAT1/capacity)] %Y/%m/%d %H:%M"
View sqrt.go
package main
import (
"fmt"
"math"
)
func sqrt_newton(x float64) float64 {
z, prev := 1.0, 3.0
const threshold = 1e-15
View c.js
var c = function(){ $('div#bigCookie').click(); };
setInterval(c, 1);
var g = function(){$('div#goldenCookie').click();};
setInterval(g, 5000);
var u0 = function(){$('div#upgrade0').click();};
setInterval(u0, 1000);
var calculator = function() {
@tatsuru
tatsuru / c.c
Created May 8, 2013
chdir(2) and symbolic link
View c.c
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc, char **argv) {
chdir(argv[1]);
pid_t pid = getpid();
printf("%d\n", (int)pid);
fflush(stdout);
sleep(60);
View gist:5402106
files = `git diff --name-only \`git describe --abbrev=0 --tags 'HEAD'\` \`git describe --abbrev=0 --tags 'HEAD^'\` #{local_cookbook_path}`.chomp.split("\n")
updated_cookbooks = files.map { |f| f.sub(/^cookbooks\/([^\/]+)\/.*$/, '\1')}.uniq
@tatsuru
tatsuru / Makefile
Created Oct 3, 2012
line to add to recent mysql Makefile when creating sandbox
View Makefile
MYSQL_NO_DASH_VERSION = 5.6.7
You can’t perform that action at this time.