社会人のための趣味CTFまとめ http://hority-ctf.blogspot.jp/2014/08/ctf.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'midilib' | |
seq = MIDI::Sequence.new() | |
File.open(ARGV[0], 'rb') { |file| seq.read(file) } | |
events = [ ] | |
id = 0 | |
seq.tracks.each do |track| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import gym | |
from gym.spaces import Discrete,Box | |
# ------------------------------------------- | |
# Policies | |
# ------------------------------------------- | |
class DeterministicDiscreteActionLinearPolicy(object): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gh --description 'Open the webpage for the current github repo/branch' | |
set -l fetch_url (command git remote --verbose show -n origin ^/dev/null | command grep Fetch | cut -c 14- ) | |
#did we get an exit status? | |
if [ $status -gt 0 ] | |
echo 'Not a git repo.' | |
return 1 | |
end | |
if [ -z $fetch_url ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Requires pychromecast. | |
Install with `pip install pychromecast` | |
usage: cast.py [-h] -d DEVICE -v VIDEO | |
Cast YouTube videos headlessly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from gensim.models import word2vec | |
import MeCab | |
import random | |
model = word2vec.Word2Vec.load("oogiri_gensim.model") | |
tagger = MeCab.Tagger("-Ochasen") | |
def word_and_kind_parse(line): | |
line_word = line.split("\t") | |
if len(line_word) < 2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun rmarkdown-to-html () | |
"Run knitr::knit2html on the current file" | |
(interactive) | |
(shell-command | |
(format "Rscript -e \"knitr::knit2html('%s')\"" | |
(shell-quote-argument (buffer-file-name))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <iostream> | |
#include <map> | |
#include <numeric> | |
#include <set> | |
#include <sstream> | |
#include <string> | |
#include <vector> | |
#include <cmath> | |
using namespace std; |