Skip to content

Instantly share code, notes, and snippets.

@snop-snov
snop-snov / hooks prepare-commit-msg
Created April 13, 2018 17:02
chmod 755 .git/hooks/prepare-commit-msg
#!/bin/bash
branchPath=$(git symbolic-ref -q HEAD)
[[ $branchPath =~ [[:alpha:]]+/(TD-[[:digit:]]+) ]]
refs="${BASH_REMATCH[1]}"
firstLine=$(head -n1 $1)
if [ -n "$refs" ] ;then
# gem install midilib
require 'midilib/io/seqreader'
require 'midilib/io/seqwriter'
require 'midilib/sequence'
file_name = 'tsoy-star.mid'
mtracks = []
seq = MIDI::Sequence.new()
case 0:
ld_print_line(8, 0b 00111100);
ld_print_line(7, 0b 00100100);
ld_print_line(6, 0b 00100100);
ld_print_line(5, 0b 00100100);
ld_print_line(4, 0b 00100100);
ld_print_line(3, 0b 00100100);
ld_print_line(2, 0b 00100100);
ld_print_line(1, 0b 00111100);
break;
case 0:
ld_print_line(8, 0b00111100);
ld_print_line(7, 0b00100100);
ld_print_line(6, 0b00100100);
ld_print_line(5, 0b00100100);
ld_print_line(4, 0b00100100);
ld_print_line(3, 0b00100100);
ld_print_line(2, 0b00100100);
ld_print_line(1, 0b00111100);
break;
case 0:
ld_print_line(0, 0b00111100);
ld_print_line(1, 0b00100100);
ld_print_line(2, 0b00100100);
ld_print_line(3, 0b00100100);
ld_print_line(4, 0b00100100);
ld_print_line(5, 0b00100100);
ld_print_line(6, 0b00100100);
ld_print_line(7, 0b00111100);
break;
{{1, 9, 0}, {1, 5, 48}, {0, 9, 48}, {1, 1, 96}, {0, 5, 96}, {1, 5, 144}, {0, 5, 192}, {1, 10, 192}, {0, 1, 240}, {1, 6, 240}, {0, 10, 240}, {1, 2, 288}, {0, 6, 288}, {1, 6, 336}, {0, 6, 384}, {1, 11, 384}, {0, 2, 432}, {1, 7, 432}, {0, 11, 434}, {1, 3, 480}, {0, 7, 480}, {1, 7, 528}, {0, 7, 576}, {1, 12, 576}, {0, 3, 624}, {1, 8, 624}, {0, 12, 625}, {1, 4, 672}, {0, 8, 672}, {1, 8, 720}, {0, 8, 744}, {1, 9, 768}, {0, 4, 816}, {1, 5, 816}, {0, 9, 816}, {1, 1, 864}, {0, 5, 864}, {1, 5, 912}, {1, 10, 960}, {0, 5, 967}, {0, 1, 1008}, {1, 6, 1008}, {0, 10, 1008}, {1, 2, 1056}, {0, 6, 1056}, {1, 6, 1104}, {0, 6, 1152}, {1, 11, 1152}, {0, 2, 1200}, {1, 7, 1200}, {0, 11, 1202}, {1, 3, 1248}, {0, 7, 1248}, {1, 7, 1296}, {0, 7, 1344}, {1, 12, 1344}, {0, 3, 1392}, {1, 8, 1392}, {0, 12, 1392}, {1, 4, 1440}, {0, 8, 1441}, {0, 4, 1488}, {1, 8, 1488}, {1, 4, 1512}, {0, 8, 1512}, {0, 4, 1536}, {1, 9, 1536}, {1, 5, 1584}, {0, 9, 1584}, {1, 1, 1632}, {0, 5, 1632}, {1, 5, 1680}, {0, 5, 1728}, {1, 10, 1728}, {0, 1, 1776}, {1, 6,
{{1, 9, 0}, {1, 5, 48}, {0, 9, 48}, {1, 1, 96}, {0, 5, 96}, {1, 5, 144}, {0, 5, 192}, {1, 10, 192}, {0, 1, 240}, {1, 6, 240}, {0, 10, 240}, {1, 2, 288}, {0, 6, 288}, {1, 6, 336}, {0, 6, 384}, {1, 11, 384}, {0, 2, 432}, {1, 7, 432}, {0, 11, 434}, {1, 3, 480}, {0, 7, 480}, {1, 7, 528}, {0, 7, 576}, {1, 12, 576}, {0, 3, 624}, {1, 8, 624}, {0, 12, 625}, {1, 4, 672}, {0, 8, 672}, {1, 8, 720}, {0, 8, 744}, {1, 9, 768}, {0, 4, 816}, {1, 5, 816}, {0, 9, 816}, {1, 1, 864}, {0, 5, 864}, {1, 5, 912}, {1, 10, 960}, {0, 5, 967}, {0, 1, 1008}, {1, 6, 1008}, {0, 10, 1008}, {1, 2, 1056}, {0, 6, 1056}, {1, 6, 1104}, {0, 6, 1152}, {1, 11, 1152}, {0, 2, 1200}, {1, 7, 1200}, {0, 11, 1202}, {1, 3, 1248}, {0, 7, 1248}, {1, 7, 1296}, {0, 7, 1344}, {1, 12, 1344}, {0, 3, 1392}, {1, 8, 1392}, {0, 12, 1392}, {1, 4, 1440}, {0, 8, 1441}, {0, 4, 1488}, {1, 8, 1488}, {1, 4, 1512}, {0, 8, 1512}, {0, 4, 1536}, {1, 9, 1536}, {1, 5, 1584}, {0, 9, 1584}, {1, 1, 1632}, {0, 5, 1632}, {1, 5, 1680}, {0, 5, 1728}, {1, 10, 1728}, {0, 1, 1776}, {1, 6,
@snop-snov
snop-snov / test
Last active February 17, 2018 17:31
{{1, 1, 0}, {1, 5, 96}, {0, 1, 96}, {1, 1, 192}, {0, 5, 192}, {0, 1, 288}, {1, 9, 288}, {1, 1, 384}, {0, 9, 384}, {1, 5, 480}, {0, 1, 483}, {1, 1, 576}, {0, 5, 576}, {0, 1, 672}, {1, 9, 672}, {1, 1, 768}, {0, 9, 768}, {0, 1, 864}, {1, 5, 864}, {1, 1, 960}, {0, 5, 960}, {1, 9, 1056}, {0, 1, 1056}, {1, 1, 1152}, {0, 9, 1152}, {0, 1, 1248}, {1, 5, 1248}, {1, 1, 1344}, {0, 5, 1344}, {0, 1, 1440}, {1, 9, 1440}, {1, 1, 1536}, {0, 9, 1536}, {0, 1, 1632}, {1, 5, 1632}, {1, 1, 1728}, {0, 5, 1728}, {1, 9, 1824}, {0, 1, 1835}, {1, 1, 1920}, {0, 9, 1920}, {0, 1, 2016}, {1, 5, 2016}, {1, 1, 2112}, {0, 5, 2112}, {1, 9, 2208}, {0, 1, 2209}, {1, 2, 2304}, {0, 9, 2304}, {0, 2, 2400}, {1, 6, 2400}, {1, 2, 2496}, {0, 6, 2496}, {1, 10, 2592}, {0, 2, 2592}, {1, 2, 2688}, {0, 10, 2688}, {1, 6, 2784}, {0, 2, 2790}, {1, 2, 2880}, {0, 6, 2880}, {1, 10, 2976}, {0, 2, 2978}, {1, 3, 3072}, {0, 10, 3072}, {1, 7, 3168}, {0, 3, 3169}, {1, 3, 3264}, {0, 7, 3264}, {0, 3, 3360}, {1, 11, 3360}, {1, 3, 3456}, {0, 11, 3456}, {0, 3, 3552}, {1, 7,

Keybase proof

I hereby claim:

  • I am snop-snov on github.
  • I am snop_snov (https://keybase.io/snop_snov) on keybase.
  • I have a public key ASDGqKjcldwK9HTGagybHC6ON-eoKLTRQPf_71ZWTeR-Fwo

To claim this, I am signing this object:

@snop-snov
snop-snov / example.rb
Last active August 29, 2015 14:18
rails code
# Controller examples
class Web::Admin::EventsController < Web::Admin::ApplicationController
def index
@q = Event.ransack(params[:q])
@events = @q.result.page(params[:page]).per(100).decorate
end
def new
@event = EventType.new
end