Skip to content

Instantly share code, notes, and snippets.

View seiji's full-sized avatar
🏠
Working from home

Seiji Toyama seiji

🏠
Working from home
View GitHub Profile
#!/usr/bin/env ruby
require 'mongo-hadoop'
MongoHadoop.map do |document|
if document['user'] and document['user']['time_zone']
[{ :_id => document['user']['time_zone'], :count => 1 }]
else
[{ :_id => 'Unknown', :count => 1 }]
end
end
@seiji
seiji / gist:3010771
Created June 28, 2012 11:26
redis-benchmark-sortedset.patch
diff --git src/redis-benchmark.c src/redis-benchmark.c
index 19eb491..34ee0d3 100644
--- src/redis-benchmark.c
+++ src/redis-benchmark.c
@@ -73,6 +73,10 @@ static struct config {
int loop;
int idlemode;
char *tests;
+
+ /* add zincr */
#!/usr/bin/env ruby
require 'socket'
if $0 == __FILE__
# write this
gs = TCPServer.open("", 12345)
socks= [gs]
addr= gs.addr
addr.shift
@seiji
seiji / new_linode_centos6.markdown
Created May 17, 2012 04:48 — forked from mmrwoods/new_linode_centos6.markdown
Make me a new CentOS linode

Make me a new CentOS linode

Notes:

  • Change, me, myhost, myip etc. to your username, hostname, ip address and so on.
  • Run all commands as root unless otherwise directed.
  • You might want to look at mounting /var and /home on separate partitions.
  • I've just allowed all members of the wheel group to operate as root. This is the height of laziness and highlights the fact that I'm just a developer that's stolen a sysadmin's woolly hat. It works fine, but the phrase "can do better" springs to mind.
@seiji
seiji / gist:2716306
Created May 17, 2012 04:18
input_userauth_request
a
abbey
abbie
abby
abc
abc123
abcd
abcde
abcdef
abeni
#!/usr/bin/env ruby
require 'redis'
class UserNotFoundException < Exception; end
class UserRanking
KEY="ranking"
def initialize(user_id)
@redis= Redis.new
@seiji
seiji / jenkins-build-Unity-iPhone.sh
Created May 11, 2012 02:27
jenkins-build-Unity-iPhone-TestFlight
UNITY_APP_PATH=/Applications/Unity3.4/Unity.app/Contents/MacOS/Unity
UNITY_PROJECT_PATH=$WORKSPACE/Unity
UNITY_EDITOR_LOG_PATH=~/Library/Logs/Unity/Editor.log
XCODE_PROJECT_PATH=$WORKSPACE/Unity-iPhone
KEYCHAIN_LOCATION=~/Library/Keychains/login.keychain
XCODE_PROJECT_CONFIG_PATH=$XCODE_PROJECT_PATH/Unity-iPhone.xcodeproj
### EDIT AREA START
UNITY_BATCH_EXECUTE_METHOD=XXXXX
@seiji
seiji / gist:2145615
Last active October 2, 2015 01:28
iPhonePlatformString
// ARMv6:
// iPhone (v1.0.0 ~ v3.1.3)
// iPhone 3G (v2.0.0 ~ v4.2.1)
// iPod Touch (v1.1.0 ~ v3.1.3)
// iPod Touch (2nd) (v2.1.2 ~ v4.2.1)
// ARMv7:
// iPhone 3GS (v3.0.0 ~ )
// iPhone 4 (GSM) (v4.0.0 ~ ) *
// iPhone 4 (CDMA) (v4.2.5 ~ ) *
// iPhone 4S (v5.0.0 ~ ) *
mv ~/.rvm ~/.rvm_org
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
rvm reload
rvm pkg install readline
rvm pkg install openssl
rvm pkg install zlib
rvm pkg install iconv
rvm install ruby-1.9.3 --with-openssl-dir=~$HOME/.rvm/usr --with-iconv-dir=$HOME/.rvm/usr
(defun insert-datetime ()
(interactive "P")
(insert (format-time-string "%Y-%m-%d %H:%M:%SZ" nil "Z")))