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
@tatsuru
tatsuru / awsevent2gcal
Last active May 25, 2018 — forked from i2tsuki/awsevent2gcal
AWS のイベントを calendar に登録するくん
View awsevent2gcal
#!/bin/sh
set -eux
PROFILE="default"
RESP="$(aws --profile ${PROFILE} --region "us-east-1" health describe-events --query 'events[?eventTypeCategory==`scheduledChange` && statusCode == `upcoming`]')"
LENGTH="$(echo ${RESP} | jq 'length')"
for i in $(seq 0 $(($LENGTH-1)))
@tatsuru
tatsuru / mackerel-plugin-theschwartz.sh
Created Dec 19, 2014
Theschwartz job count plugin for Mackerel
View mackerel-plugin-theschwartz.sh
#!/bin/bash
usage() {
echo "Usage: $0 [-m METRIC_NAME] [-u USER] [-p PASSWORD] [-d DATABASE] [-h]"
}
METRIC_NAME=theschwartz.count
DBUSER=root
DBPASS=
DATABASE=theschwartz
View output.txt
...
write(2, "test\n", 5test
) = 5
exit_group(0) = ?
+++ exited with 0 +++
View nothing.go
tatsuru@moryo$ strace ./nothing /tmp
execve("./nothing", ["./nothing"], [/* 53 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0x4b4868) = 0
sched_getaffinity(0, 8192, [f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]) = 64
mmap(0xc000000000, 65536, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc000000000
munmap(0xc000000000, 65536) = 0
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1a20c3f000
mmap(0xc820000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc820000000
mmap(0xc81fff8000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc81fff8000
mmap(0xc000000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xc000000000
@tatsuru
tatsuru / parse.rb
Last active Feb 1, 2016
ec2 RI parser
View parse.rb
#!/usr/bin/env ruby
require 'json'
def parse(uri)
JSON.parse `curl -s #{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
puts %w(
region
View gist:7fbaa10fa425f5808764
tatsuru@moryo$ for char in {a..z}; do; which -a $char; done ~
a not found
b not found
c not found
d not found
e not found
f not found
g not found
h not found
i not found
@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() {
You can’t perform that action at this time.