Skip to content

Instantly share code, notes, and snippets.

View eccyan's full-sized avatar

eccyan eccyan

View GitHub Profile
@eccyan
eccyan / factorial.out
Created September 21, 2014 13:45
ruby-llvm sample
✗ LD_LIBRARY_PATH="`llvm-config --libdir`" bundle exec ruby samples/factorial.rb 1
; ModuleID = 'Factorial'
define i32 @fac(i32 %n) {
entry:
%test = icmp eq i32 %n, 1
br i1 %test, label %result, label %recur
recur: ; preds = %entry
%n-1 = sub i32 %n, 1
@eccyan
eccyan / ruby_hiroba.md
Created September 21, 2014 05:43
RubyHirobaスライド

Ruby Hiroba

テルミーの歴史

http://tell-me.jp

リードエンジニア @eccyan

@eccyan
eccyan / file1.txt
Created July 30, 2014 12:22
Resqueでコネクションプールをしない ref: http://qiita.com/eccyan/items/8f7876bba9d18ca2c483
$ mysql YOUR_DATABASE -e 'SHOW PROCESSLIST;' | grep -v + | cut -f 3 | cut -d ':' -f 1 | sort | uniq -c
@eccyan
eccyan / file0.txt
Created June 25, 2014 10:56
Capistranoでroleが空の場合でも処理を続行させる方法 ref: http://qiita.com/eccyan/items/e494e418eed2e3fc9f79
`deploy:your_task' is only run for servers matching {:roles=>[:role]}, but no servers matched
@eccyan
eccyan / redis.rb
Created May 7, 2014 07:26
Rails でサクッと Redis を Master/Slave 構成にする ref: http://qiita.com/eccyan/items/7a7bdeb693f4df16b8f9
class Redis
class Client
def call(command, &block)
master_host = MASTER_HOST_URI
slave_host = SLAVE_HOST_URI
# Slave に向けたいお好きなコマンドを登録
slave_commands = [:get, :hget, :hgetall]
disconnect
@eccyan
eccyan / prepare-commit-msg
Created March 31, 2014 03:26
prepare-commit-msg for JIRA
#!/usr/bin/env ruby
exit if %w(merge).include? $*[1]
current_branch = `git rev-parse --abbrev-ref HEAD`
if /^([A-Z]{2,}-\d+).*/ =~ current_branch
commit_messages = File.readlines($*[0])
open($*[0], 'w') do |file|
commit_messages.unshift "#{$1} " << commit_messages.shift
file.puts commit_messages
@eccyan
eccyan / worker.rb
Last active August 29, 2015 13:57
Resque の Worker 毎に Redis のホストを設定する ref: http://qiita.com/eccyan/items/c10b4b0080c235b65976
require 'worker_base'
class Worker < WorkerBase
@redis = OTHER_REDIS_HOST
# ...
end
#include <SPI.h>
const int MINIMUM = 1000;
const int X_MINUS_PIN = 7;
const int X_PLUS_PIN = 6;
const int Y_MINUS_PIN = 5;
const int Y_PLUS_PIN = 4;
const int Z_MINUS_PIN = 3;
const int Z_PLUS_PIN = 2;
@eccyan
eccyan / play_sound.ino
Created January 3, 2014 06:03
Play sound with the serial communication Arduino
#define BUTTON_PIN 2
#define SPEAKER_PIN 3
#define CONTROLLER_PIN 9
#define FREQUENCY 440
#define DURATION 300
#define COMMAND_LENGTH_MAX 10
char current_command[COMMAND_LENGTH_MAX+1];
int command_index = 0;
@eccyan
eccyan / file0.txt
Created December 5, 2013 11:31
本日 Ruby でハマったカンマの罠 ref: http://qiita.com/eccyan/items/01333620a3a6d5675c85
id = 1,
name = "eccyan"