Skip to content

Instantly share code, notes, and snippets.

View enerick's full-sized avatar

enerick enerick

  • MIXI, Inc.
  • Tokyo, Japan
View GitHub Profile
@enerick
enerick / CA184.ml
Created December 13, 2011 22:28
愚直実装版1次元CAくん(状態を配列に収めてインデックスに状態を割り当てるみたいな工夫は一切無い)
let rec print_int_list = function
| [] -> print_newline ()
| x::xs -> print_int x; print_int_list xs;;
(* リストの両端のはみ出しに対応させた拡張nth関数 *)
let nth_ex li = function
| n when n < 0 -> List.nth li (List.length li - 1)
| n when n >= (List.length li) -> List.nth li 0
| n -> List.nth li n;;
@enerick
enerick / tex.sh
Created June 7, 2012 21:55
単発tex用スクリプト
#!/bin/sh
#Mac以外は知らない
#拡張子を除いた名前を引数として渡す(ex. hoge.tex -> hoge)
platex $1.tex
if [ $? -eq 0 ];then
dvipdfmx $@
else
exit 0
@enerick
enerick / private.xml
Created May 26, 2015 10:55
a configuration file for Karabiner
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>TopreCorporation</vendorname>
<vendorid>0x0853</vendorid>
</devicevendordef>
<item>
<name>For RealForce</name>
<name>Set function keys to special feature</name>
<appendix>Assign special feature keys to F1 to F12 on RealForce</appendix>
@enerick
enerick / setting.vssettings
Created July 31, 2015 02:09
VSショートカットキー設定。Ctrl+a, Ctrl+e で行頭行末移動、全選択は Alt+a、Ctrl+g, Alt+g Alt+g で指定行ジャンプ
<UserSettings>
<ApplicationIdentity version="11.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="Environment" RegisteredName="Environment"/>
</ToolsOptions>
<Category name="Environment_Group" RegisteredName="Environment_Group">
<Category name="Environment_KeyBindings" Category="{F09035F1-80D2-4312-8EC4-4D354A4BCB4C}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_KeyBindings" PackageName="Visual Studio Environment Package">
<Version>11.0.0.0</Version>
<KeyboardShortcuts>
<ScopeDefinitions>
@enerick
enerick / basic.ex
Last active December 19, 2019 18:27
introduction to params (v2.1.2?)
# モジュール内定義
defmodule M do
use Params
defparams person_params(%{
name!: :string,
age: :integer
})
end
@enerick
enerick / bakusoku-chouseisan.js
Last active September 2, 2021 09:15
爆速調整さんブックマークレット
javascript: document.querySelectorAll(".oax").forEach(function(e) {e.addEventListener("mouseenter", function() { e.parentNode.childNodes.forEach((e) => { e.classList.remove("active"); }); e.classList.add("active"); e.parentNode.firstElementChild.value = parseInt(e.id.slice(-1)) + 1}, false);})
@enerick
enerick / fetch-pr-list.sh
Last active September 14, 2021 10:21
Create md file that lists PR/Issues I created within the period (requires `gh` command)
for i in 1 2 3 4 5
do
gh api -X GET search/issues \
-f q='archived:false created:2021-04-01..2021-09-30 author:@me sort:created-asc' \
-f per_page=100 \
-f page=$i \
-q '.items | map(. += { "repo": (.html_url | split("/") | .[-4] + "/" + .[-3] + "#" + .[-1]), "date": (.created_at | split("T") | .[0]) }) | map("1. " + .date + " [" + .title + "](" + .html_url + ") (" + .repo + ")") | .[]' \
>> pr.md
done