Skip to content

Instantly share code, notes, and snippets.

View st98's full-sized avatar

st98 st98

View GitHub Profile
@st98
st98 / 4.ml
Last active August 29, 2015 14:13
OCaml 入門。http://try.ocamlpro.com/ の Lesson 4 辺り。
(* 試す *)
let f = function
| [| x; (_, _) |] -> x
| _ -> 0, 0;;
f [| 1, 2; 3, 4 |];; (* => (1, 2) *)
let f = function
| [| x; _ |]::_ -> x
| _ -> 0, 0;;
@st98
st98 / swapcase.ml
Last active August 29, 2015 14:13
OCaml 入門。Python の str.swapcase() みたいな。
let swapcase c = match c with
| 'A' .. 'Z' -> Char.lowercase c
| 'a' .. 'z' -> Char.uppercase c
| _ -> c
let swapcase_s s = String.map swapcase s;;
swapcase_s "AbC";; (* => "aBc" *)
@st98
st98 / String#map.js
Last active August 29, 2015 14:13
String#map。
Object.defineProperty(String.prototype, 'map', {
value: function () {
return Array.prototype.map.apply(this, arguments).join('');
},
enumerable: false,
configurable: true,
writable: false
});
@st98
st98 / bf.coffee
Created December 28, 2014 14:44
CoffeeScript で Brainf*ck のインタプリタ。
class Brainfuck
_parse = (prog) ->
prog.match(/[-+><\.,\[\]]/g)
@run: (prog, input=prompt, output=console.log.bind(console)) ->
_memory = []
_pointer = 0
_pc = 0
_depth = 0
prog = _parse prog
while prog[_pc]
@st98
st98 / coffee.txt
Last active August 29, 2015 14:12
coffee -s -n, coffee -s -t
> python -c "print('console.log do -> 1')" | coffee -s -n
Block
Call
Value "console"
Access "log"
Call
Code
Block
Value "1"
@st98
st98 / blog.json
Last active August 29, 2015 14:11
python convert.py -c blog.json x.json とかそういう感じで。https://gist.github.com/st98/846f81d5bd40c22f5079 と組み合わせて使う。アレより適当。
{"title": "ぶろぐー"}
@st98
st98 / p.py
Last active August 29, 2015 14:11
Movable Type のアレを JSON にするヤツ、自分用なので動けばいいという感じ。
import json
import os.path
import re
import sys
def parse(prog):
result = []
entry = {}
mkey = None
mvalue = None
@st98
st98 / s.js
Created December 4, 2014 19:01
seccon ranking
document.getElementById('ranking_table').children.length;
@st98
st98 / memo.md
Last active June 4, 2022 04:37
Advent Calendar CTF 2014 の write-up。ブログに移動しました -> https://st98.github.io/diary/posts/2014-12-26-adctf.html

Advent Calendar CTF 2014

ぼっチーム omakase として参加した。最終的に獲得できたポイントは 173 点でチーム順位は 24 位 (505 チーム中) だった。
1 ~ 14 日目、21 ~ 22 日目、25 日目の問題を解いた。

1 日目 warmup (misc)

'0x41444354465f57334c43304d335f37305f414443374632303134'.match(/[0-9a-f]{2}/g).map(function(c){return String.fromCharCode(parseInt(c, 16))}).join('');
flag: ADCTF_W3LC0M3_70_ADC7F2014
@st98
st98 / no-click.js
Last active August 29, 2015 14:10
クリック禁止です!
// Array.from($$('*')).forEach(...);
[].forEach.call($$('*'), function(e) {
e.addEventListener('click', function(e) {
alert('クリック禁止です!');
e.preventDefault();
e.stopPropagation();
},false);
});