Skip to content

Instantly share code, notes, and snippets.

Sorah Fukumori sorah

Block or report user

Report or block sorah

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 72.go
// http://tour.golang.org/#72
package main
import "code.google.com/p/go-tour/tree"
import "fmt"
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
if t == nil {
View 73.go
// http://tour.golang.org/#73
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
View dmesg
[560717.513222] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: (null)
[562910.917018] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
[562910.917169] IP: [<ffffffff811eddf2>] ext4_ext_remove_space+0x821/0xb7a
[562910.917292] PGD 2679067 PUD 26d7067 PMD 0
[562910.917375] Oops: 0000 [#1] SMP
[562910.917439] CPU 0
[562910.917474] Modules linked in: ata_generic pata_acpi radeon ttm drm_kms_helper drm i2c_algo_bit tg3 pata_atiixp shpchp pt3_drv(O) sp5100_tco i2c_piix4 i2c_core pcspkr amd64_edac_mod edac_core edac_mce_amd k10temp
[562910.917884]
[562910.917914] Pid: 1939, comm: rm Tainted: G W O 3.4.9-gentoo #8 HP ProLiant MicroServer
[562910.918067] RIP: 0010:[<ffffffff811eddf2>] [<ffffffff811eddf2>] ext4_ext_remove_space+0x821/0xb7a
View airplay.rb
require 'socket'
require 'securerandom'
session = SecureRandom.uuid
TCPSocket.open('Apple-TV.local', 7000) do |io|
payload = <<-EOF
Content-Location: ...
Start-Position: 0
EOF
View str-dn2030_ctl.rb
# STR-DN2030 TCP Control Protocol (analyze)
sock = TCPSocket.open('x.x.x.x', 33335)
###
get_vol_status = "\x02\x04\xa0\x92\x00\x03\x00"
vol_up = "\x02\x03\xA0U\x00\x00"
vol_down = "\x02\x03\xA0V\x00\x00"
set_vol = "\x02\x06\xa0\x52\x00\x03".b + [26].pack('s>') + "\x00".b
@sorah
sorah / a.md
Last active Aug 29, 2015
2014 Summer Anime JP 夏アニメ
View a.md
View a.rb
n=1
a=["", ""]
$_.chomp.chars {|c| n.abs == 1 && (n*=c.to_i+1) || (s=n<=>0) && a[1<=>s] << c && (n-=s) && n!=s || (n*=-1) && n>0 && (p(a[1].to_f/a[0].to_f); a=["",""])}
# https://pbs.twimg.com/media/BvujU0bCIAMxa1O.jpg
@sorah
sorah / ip.sh
Created Oct 16, 2014
Shell script assigns given private IPv4 addresses (e.g. secondary private IP) to a EC2 instance
View ip.sh
if_macs="$(ip -o link show up | grep -v lo: | grep link/ether | sed -re 's|^[0-9]+: (.+?): .+link/ether ([0-9a-f:]+?).*$|\1,\2|')"
for if_mac in $if_macs; do
ifname="$(echo "$if_mac" | cut -d, -f 1)"
mac="$(echo "$if_mac" | cut -d, -f 2)"
ifmeta="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${mac}"
cidr="$(curl -s ${ifmeta}/subnet-ipv4-cidr-block)"
netlen="$(echo "$cidr" | cut -d/ -f 2)"
View get.rb
require 'net/https'
require 'nokogiri'
require 'uri'
require 'time'
require 'base64'
require 'openssl'
abort "Usage #{$0} zoneid" unless ARGV[0]
token = ENV['AWS_ACCESS_KEY_ID']
@sorah
sorah / r53-ddns.rb
Created Nov 18, 2014
r53-ddns (Route 53 DDNS)
View r53-ddns.rb
#!/bin/bash
new_ip=`curl -s -4 http://ifconfig.me/ip`
zone_id=$1
target_name=$2
batch_json='
{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
You can’t perform that action at this time.