Skip to content

Instantly share code, notes, and snippets.

View taskie's full-sized avatar
🐌
𝑩𝑳𝑨𝒁𝑰𝑵𝑮 𝑭𝑨𝑺𝑻

taskie taskie

🐌
𝑩𝑳𝑨𝒁𝑰𝑵𝑮 𝑭𝑨𝑺𝑻
View GitHub Profile
#!/usr/bin/env ruby
Dir.chdir($*[0]) if $*[0]
open("Encoding Errors.txt") do |f|
f.each do |line|
org, new = line.split("->").map{|x| x.strip}
if new && new != "New File Name"
`mv "#{new}" "#{org}"`
end
#!/usr/bin/env ruby
(inpath, outpath, org, dst = $*)
unless inpath && outpath && org && dst
puts "usage: conv_exs infile outfile org dst"
exit 1
end
binstr = nil
@taskie
taskie / n4317.cc
Last active August 29, 2015 14:19
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4317.pdf
#include <iterator>
namespace n4317
{
namespace internal
{
template <typename RanIter, typename Dist>
void advance_helper(RanIter & i, RanIter e, Dist n, std::random_access_iterator_tag)
@taskie
taskie / range.js
Created May 24, 2015 02:39
generator "range" like Python 3
function * range(n, end, step = 1) {
if (typeof end === "undefined") {
end = n;
n = 0;
}
if (step === 0) {
throw Error("step must not be zero")
}
if (end > n && step > 0) {
for (let i = n; i < end; i += step) yield i;
#!/usr/bin/env ruby
devices = `xcrun simctl list devices`.each_line do |line|
if line =~ /[^\(]+\(([^\)]+)\)/
puts $1
`xcrun simctl delete #{$1}`
end
end
#!/bin/bash
status () {
cd .vnc
local pidfile=$(hostname):1.pid
if [[ -f $pidfile ]]; then
local pid=$(cat $pidfile)
echo PID: $pid
if kill -0 $pid; then
echo "running"
@taskie
taskie / fonts.conf
Last active February 7, 2016 15:47
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- fallback -->
<match target="pattern">
<test name="family" compare="not_eq" qual="all">
<string>sans-serif</string>
</test>
<test name="family" compare="not_eq" qual="all">
<string>serif</string>
# How to install Arch Linux
# ref.) https://wiki.archlinuxjp.org/index.php/%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%82%AC%E3%82%A4%E3%83%89
# ref.) http://qiita.com/macchaberrycream/items/1dfabe8b710dc638e3f9
# (boot from install CD)
loadkeys jp106
EDITOR=vi
# partition
@taskie
taskie / genwebfonts.py
Created March 28, 2016 09:28
fontforge script to generate subsets of fonts
#!/usr/bin/env fontforge -lang=py -script
# -*- coding: utf-8 -*-
import fontforge
import sys
import os
def _select_codepoint(codepoint, selection, more=True):
more_str = 'more' if more else 'less'
if isinstance(codepoint, tuple) and len(codepoint) == 2:
@taskie
taskie / pbc.pde
Last active April 12, 2016 13:51
P. B. C. (UTMC 2016年度初心者向けプログラミング講習会サンプルコード/シンプルな避けゲー 魔改造例)
//P. B. C. (Periodic Boundary Condition) by taskie
//derived from simple yoke-game sample by MASA
//color scheme: http://ethanschoonover.com/solarized
float boxW, boxH, boxX, boxY;
float bulletX[], bulletY[];//bullet position (x, y)
float bulletVx[], bulletVy[];//bullet velocity (x, y)
boolean isMyBullet[];
float bulletR = 5;//bullet radius