Skip to content

Instantly share code, notes, and snippets.

View tondol's full-sized avatar

tondol tondol

View GitHub Profile
# 5578864439
# ENV: Ruby
# POINT: 順列をすべて数え上げようと思うと計算量が大きくなりすぎるので,メモ化により枝刈りする
### この問題で出現する宝石列は,
### 与えられた宝石の順列を(辞書順で昇順となるような順序で)すべて求め,
### 各順列に対して先頭から1個,先頭から2個,先頭から3個……を取り出して,
### 重複するものを取り除きながら並べていくことで得ることができます。
###
### 例題(minis.txt)の場合は,出現する宝石の個数が少ないことから,
@tondol
tondol / macaron.md
Last active August 29, 2015 13:57
スクフェスのマカロン計算

マカロン計算

前提

イベント曲HARD1回で加算されるptが約230
ミス分を考慮して加算ptを225とする
また,プレイ1回に必要なマカロンが45

変数

@tondol
tondol / brewfile
Created April 16, 2014 02:10
brewfile
tap phinze/homebrew-cask || true
tap homebrew/versions|| true
update || true
install brew-cask || true
install git || true
install openssl || true
install wget || true
install jq || true
install python3 || true
@tondol
tondol / linkify.js
Last active August 29, 2015 14:02
Twitter APIが返すJSONのlinkify処理
function h(s) {
var map = {
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
'\'' :'&#39;',
'"' :'&quot;'
};
function f(s) { return map[s]; }
return s.replace(/<|>|&|'|"/g, f);
@tondol
tondol / array_at.php
Last active August 29, 2015 14:02
PHPのNoticeを消すのに便利な奴
// 第1引数に配列もしくはオブジェクトを,
// 第2引数以降に配列のキー名もしくはプロパティ名を与える
// 指定した要素やプロパティが存在しなければNULLが返却される
function array_at()
{
$numargs = func_num_args();
$args = func_get_args();
$arr = array_shift($args);
foreach ($args as $index) {
if (is_array($arr)) {
@tondol
tondol / mactex2013-emb-fonts.md
Last active August 29, 2015 14:03
MacTex2013環境でPDFに日本語フォントを埋め込む

PDFに日本語フォントを埋め込む

pdffontsの導入

brew install xpdf
<div id="renderer">
<svg id="svg"></svg>
<canvas id="canvas"></canvas>
</div>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script>
<script src="https://canvg.googlecode.com/svn/trunk/StackBlur.js"></script>
<script src="https://canvg.googlecode.com/svn/trunk/canvg.js"></script>
@tondol
tondol / vuejs-propchange.html
Last active August 29, 2015 14:10
Vue.js: viewから配列の要素を参照する
<script src="http://cdnjs.cloudflare.com/ajax/libs/vue/0.11.0/vue.min.js"></script>
<div id="container">
<div>
0:{{array[0].name}}, {{array[0].prop}}
</div>
<div v-repeat="array" v-show="$index > 0">
{{$index}}:{{name}}, {{prop}}
</div>
</div>
<script>
@tondol
tondol / g.c
Created December 7, 2014 16:38
CODE THANKS FESTICAL 2014 G問題
#include <stdio.h>
#include <stdlib.h>
double probs[100];
double table[101][200][200]; // N,K,K
int main(void) {
int i, j, k;
int N, K;
scanf("%d%d",&N,&K);
@tondol
tondol / exaudio.sh
Created December 27, 2014 17:25
ffmpegを使ってオーディオデータを抽出するalias
# exaudio hoge.mp4 hoge.m4a
function exaudio() {
~/Documents/00scripts/ffmpeg -i $1 -vn -acodec copy $2
}
# exm4a *.mp4
# *.mp4.m4aが出力される
function exm4a() {
while [ "$1" != "" ]
do