Skip to content

Instantly share code, notes, and snippets.

View yuki24's full-sized avatar
🔢
NaN :trollface:

Yuki Nishijima yuki24

🔢
NaN :trollface:
View GitHub Profile
@yuki24
yuki24 / bash_jenkins.sh
Created November 21, 2011 05:56
Jenkins snippets
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
if [[ -n "$PS1" ]] ; then
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@yuki24
yuki24 / add_sshkey.sh
Created December 5, 2011 00:50
snippets for the blog entry http://goo.gl/VTl9k
cd ~
mkdir .ssh
touch .ssh/authorized_keys
emacs .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
@yuki24
yuki24 / set_iptables.sh
Created January 3, 2012 10:08
iptables sample
#!/bin/bash
LAN=eth0
LOCALNET_MASK=`ifconfig $LAN|sed -e 's/^.*Mask:\([^ ]*\)$/\1/p' -e d`
LOCALNET_ADDR=`netstat -rn|grep $LAN|grep $LOCALNET_MASK|cut -f1 -d' '`
LOCALNET=$LOCALNET_ADDR/$LOCALNET_MASK
#/etc/init.d/iptables stop
@yuki24
yuki24 / client.c
Created February 3, 2012 19:04
sever client exercise
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
void error(const char *msg){
@yuki24
yuki24 / fried_tofu.txt
Created February 24, 2012 18:01
comparison of FriedTofu and Kodachi
$ ab -n 100 -c 10 http://friedtofu-demo-yuki24.herokuapp.com/rfit/100/100......
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking friedtofu-demo-yuki24.herokuapp.com (be patient).....done
Server Software: Jetty(7.5.4.v20111024)
Server Hostname: friedtofu-demo-yuki24.herokuapp.com
@yuki24
yuki24 / mass_assignment.rb
Created March 6, 2012 02:09
Mongoid's Mass assignment
> require 'rubygems'
=> false
> require 'mongoid'
=> true
> class Person
> include Mongoid::Document
> end
=> Person
> Person
=> Person
@yuki24
yuki24 / robospecs-0.2-SNAPSHOT.sh
Created March 27, 2012 01:40
publish robospecs 0.2-SNAPSHOT locally
git clone git://github.com/jbrechtel/robospecs.git
cd robospecs
sbt publish-local
@yuki24
yuki24 / rack.rb
Created April 5, 2012 05:37
simplest rack app
require 'rack'
Rack::Server.start(app: Proc.new{|env| [200, {'Content-Type' => 'text/html'}, env]}, Port: 8080)
@yuki24
yuki24 / trace.txt
Created June 25, 2012 13:50
Ruby bug?
/home/yuki/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:761: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0066 p:0015 s:0266 b:0264 l:000263 d:000263 METHOD /home/yuki/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:761
c:0065 p:0011 s:0256 b:0256 l:000255 d:000255 METHOD /home/yuki/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755
c:0064 p:0048 s:0253 b:0253 l:000252 d:000252 METHOD /home/yuki/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:744
c:0063 p:0182 s:0250 b:0250 l:000249 d:000249 METHOD /home/yuki/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:557
c:0062 p:0031 s:0237 b:0237 l:000ac0 d:000ac0 METHOD /home/yuki/.rvm/gems/ruby-1.9.3-p194@potter/gems/capybara-1.1.2/lib/capybara/server.rb:47
c:0061 p:0011 s:0233 b:0233 l:001538 d:000232 BLOCK /home/yuki/.rvm/gems/ruby-1.9.3-p194@potter/gems/capybara-1.1.2/lib/capybara/server.rb:69
@yuki24
yuki24 / foo.rb
Created July 9, 2012 19:59
Which is wrong, me or Hashie?
require 'rubygems'
require 'hashie'
class Foo < Hashie::Mash
def initialize(arg, options = {})
options[:key]
super(options)
end
end