Skip to content

Instantly share code, notes, and snippets.

View sylph01's full-sized avatar
🔒
crypto(graphy) rules

Ryo Kajiwara sylph01

🔒
crypto(graphy) rules
View GitHub Profile
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Sample</title>
<script type="text/javascript" src="jquery-1.12.0.min.js"></script>
<script type="text/javascript">
$(function(){
$('#button').click(function(){
var list1 = $('#list1').val();
@sylph01
sylph01 / mm2.txt
Created September 11, 2016 13:50
MM2 Sealed Pool @ GP Kyoto
< White >
Kor Duelist
Arrest
Apostle's Blessing x2
Skyhunter Skirmisher
Oblivion Ring
Court Homunculus x2
Sunlance
Taj-Nar Swordsmith
Terashi's Grasp
require "minitest/autorun"
module InsertDummy
def self.insert_dummy(a)
dummy = "d"
if a.length < 2
a + [dummy].cycle(3).to_a
else
case a.length % 4
when 0 then a
@sylph01
sylph01 / doukaku08.rb
Created October 1, 2016 09:38
オフラインリアルタイムどう書くE08(http://mtsmfm.github.io/2016/10/01/doukaku-e08.html) 回答
def is_rect?(pt1, pt2, ours)
ours.include?({x: pt1[:x], y: pt2[:y]}) && ours.include?({x: pt2[:x], y: pt1[:y]}) && (pt1[:x] < pt2[:x]) && (pt1[:y] < pt2[:y])
end
def is_valid_rect?(pt1, pt2, theirs)
theirs.none? { |their_pt| (their_pt[:x] >= pt1[:x] && their_pt[:x] <= pt2[:x]) && (their_pt[:y] >= pt1[:y] && their_pt[:y] <= pt2[:y]) }
end
def area(pt1, pt2)
(pt2[:x].ord - pt1[:x].ord) * (pt2[:y] - pt1[:y])
@sylph01
sylph01 / doukaku_e08.exs
Created October 3, 2016 01:42
オフラインリアルタイムどう書くE08(http://mtsmfm.github.io/2016/10/01/doukaku-e08.html) 回答 in Elixir
defmodule DoukakuE08 do
# combination
# http://stackoverflow.com/questions/30585697/how-to-rewrite-erlang-combinations-algorithm-in-elixir
defp comb(0, _), do: [[]]
defp comb(_, []), do: []
defp comb(n, [x | xs]) do
(for y <- comb(n - 1, xs), do: [x | y]) ++ comb(n, xs)
end
defp is_rect({x1, y1}, {x2, y2}, ours) do
c = 1
File.open(ARGV[0]) do |f|
while l = f.gets
la = l.split("\"")
arg1 = la[1]
arg2 = la[3]
puts "test(#{c}, \"#{arg1}\", \"#{arg2}\")"
Karabiner
Do not remap internal keyboard
back-quote to kana/eisuu toggle
Seil
Change caps lock key -> 59(Left Ctrl)
Enable NFER -> 102(JIS eisuu)
Enable XFER -> 104(JIS kana)
Enable KATAKANA -> 54(Right Command)
class Array
def x
self[0]
end
def y
self[1]
end
end
def calculate(actions)
if actions.all?{ |c| c == 'O'}
return 2 ** (actions.count + 2) - 4
elsif actions.all?{ |c| c == 'X'}
if actions.count == 1
return 5
else
return 4 ** (actions.count - 1) + 1
end
else
X,5
O,4
OX,10
OO,12
OXX,21
OXO,18
OOX,30
OOO,28
OXXX,81
OXXO,29