Skip to content

Instantly share code, notes, and snippets.

@mururu
mururu / billboards.rb
Created January 25, 2012 06:21
Billboards - Facebook Hacker Cup 2012 Qualification Round
# 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 / hitori-game.rb
Created October 26, 2011 08:22
hitori-game .devquiz2011
=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 / web-game.js
Created October 26, 2011 07:59
web-game .devquiz2011
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 / kawadu_fuck.js
Created October 20, 2011 06:07
KawaduFuck
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++]);
}

Checked plugins

built-in

  • in_debug_agent

  • in_dummy

  • in_exec

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,
@mururu
mururu / extract_public_key.erl
Created June 25, 2015 04:45
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
@mururu
mururu / string_io.ex
Created February 6, 2014 00:40
StringIO
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