Skip to content

Instantly share code, notes, and snippets.

View yudai's full-sized avatar

Iwasaki Yudai yudai

View GitHub Profile
@yudai
yudai / ngn.path
Created May 5, 2012 15:54
patch for wide_mkduid.pl to generate NGN-compatible DUIDs
--- wide_mkduid.pl.orig 2007-12-04 05:18:51.000000000 +0900
+++ wide_mkduid.pl 2012-05-06 00:56:25.207991279 +0900
@@ -79,8 +79,9 @@
# form the first two words of the DUID data: DUID type and link type.
# link-type is assumed to be ethernet(6)!
+# but for NGN, link-type is always 1!
-$duid_data = chr(0) . chr($duidtype) . chr(0) . chr(6);
+$duid_data = chr(0) . chr($duidtype) . chr(0) . chr(1);
@yudai
yudai / gist:4591856
Created January 22, 2013 03:37
Extract highlights from kindle
$(".highlight").each(function(){console.log($(this).text().replace(/["';,.]/g, ""))})
class PropertyChain
def initialize(value)
@value = value
end
def method_missing(action, *args)
if @value.key?(action)
PropertyChain.new(@value[action])
else
nil
end
@yudai
yudai / vcap_me.sh
Created February 13, 2013 11:38
Set up script for self-hosting vcap.me domain
#!/bin/sh
cat <EOF >> /etc/bind/named.conf.local
zone "vcap.me" IN {
type master; file "vcap.me.zone"; allow-update { none; };
};
EOF
cat <EOF > /etc/bind/db/vcap.me.zone
$TTL 86400@ IN SOA localhost root (
1 ; serial (d. adams)
@yudai
yudai / Invalid
Last active December 14, 2015 15:29
with Ada.Text_IO; use Ada.Text_IO;
procedure Array_Test is
From_Array : array (1 .. 3) of Integer;
To_Array : array (1 .. 3) of Integer;
begin
From_Array := (1, 2, 3);
To_Array := From_Array;
From_Array := (others => 0);
@yudai
yudai / gist:5310346
Created April 4, 2013 13:30
Rewrite .git files to use a relative path in them
#!/usr/bin/env ruby
require 'fileutils'
require 'pathname'
def ensure_relative_gitdir()
%x{git ls-files --error-unmatch --stage}.split("\n").each do |line|
value = line.split(" ")
if value[0] == "160000"
FileUtils.cd(value[3]) do
---
properties:
domain: vcap.me
networks:
apps: default
management: default
nats:
user: nats
@yudai
yudai / gist:5518417
Last active December 17, 2015 00:09
rbenv
sudo apt-get -y install build-essential libreadline-dev libssl-dev zlib1g-dev git
git clone http://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
exec $SHELL -l
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 1.9.3-p484
rbenv global 1.9.3-p484