Skip to content

Instantly share code, notes, and snippets.

Avatar

Yuki Ito mururu

View GitHub Profile
View string_io.ex
defmodule StringIO do
def new(string) when is_binary(string) do
spawn_link(fn -> string_io_process(string) end)
end
def string_io_process(string) do
loop(:infinity, String.to_char_list!(string))
end
def loop(wait, buf) do
@mururu
mururu / otp.md
Last active Aug 29, 2015
shinjuku.ex #10 発表資料
View otp.md

Elixir ユーザーのための OTP 入門 (Shinjuku.ex #10)

話すこと

  • OTP とは何か
  • 「よくわからないけど使ったほうがいいっぽい」から「なぜ使うのかを意識して使う」になるための導入(になるといいな)
  • 詳細な API とかには触れません

だれ?

@mururu
mururu / extract_public_key.erl
Created Jun 25, 2015
extract_public_key.erl
View extract_public_key.erl
-include_lib("public_key/include/public_key.hrl").
extract_public_key(CertPath)
{ok, CertBinary} = file:read_file(CertPath),
CertPemEntries = public_key:pem_decode(CertBinary),
{'Certificate', Cert, _} = lists:keyfind('Certificate', 1, CertPemEntries),
#'OTPCertificate'{
tbsCertificate = #'OTPTBSCertificate'{
subjectPublicKeyInfo = #'OTPSubjectPublicKeyInfo'{
subjectPublicKey = PublicKey
View diff.patch
diff --git ebin/rebar.app ebin/rebar.app
index 710f8b2..b683ffb 100644
--- ebin/rebar.app
+++ ebin/rebar.app
@@ -46,7 +46,8 @@
rebar_metacmds,
rebar_getopt,
rebar_mustache,
- rmemo ]},
+ rmemo,
View CHECKED_PLUGINS.md

Checked plugins

built-in

  • in_debug_agent

  • in_dummy

  • in_exec

View kawadu_fuck.js
window.onload = function(){
var ptr = 0;
var mem = [];
var count = 1;
var input_set = function(input) {
var splited = input.split(' ');
var ary = [];
for(var i = 0, len = splited.length; i < len; ){
ary.push(splited[i++] + splited[i++]);
}
@mururu
mururu / web-game.js
Created Oct 26, 2011
web-game .devquiz2011
View web-game.js
var card_num = 0;
var card_array = new Array();
var card_twin = new Array();
//カードの要素を取得
for (var ai = 0; true; ai++){
if(document.getElementById('card' + ai) == null){
card_num = ai;
break;
}
@mururu
mururu / hitori-game.rb
Created Oct 26, 2011
hitori-game .devquiz2011
View hitori-game.rb
=begin
入力形式
T ケースの数(1<=T<=100)
N ケース1の数の個数(1<=N<=10)
a1 a2 ... aN 与えられる数(0<=an<=1,000,000)
M ケース2の数の個数
b1 b2 ... bM 与えられる数
... ...
=end
@mururu
mururu / billboards.rb
Created Jan 25, 2012
Billboards - Facebook Hacker Cup 2012 Qualification Round
View billboards.rb
# coding: utf-8
class Billboards
def initialize(input)
lines = []
open(input) do |f|
lines = f.readlines.map{|l|l.chomp!}
end
@num = lines.shift.to_i
@case = []
@mururu
mururu / soup.rb
Created Jan 25, 2012
Alphabet Soup - Facebook Hacker Cup 2012 Qualification Round
View soup.rb
# coding: utf-8
class Soup
def initialize(input)
lines = []
open(input) do |f|
lines = f.readlines.map{|l|l.chomp!}
end
@num = lines.shift.to_i
@case = lines