Skip to content

Instantly share code, notes, and snippets.

View tos-kamiya's full-sized avatar
:octocat:
one by one

Toshihiro Kamiya tos-kamiya

:octocat:
one by one
View GitHub Profile
@tos-kamiya
tos-kamiya / terminalspinner.py
Last active August 28, 2015 10:40
Spinner in terminal
# coding: utf-8
import sys
import time
import threading
import Queue
import contextlib
ANIMATION = '|/-\\'
@tos-kamiya
tos-kamiya / convEpsToSvg.py
Created April 29, 2014 23:37
convert eps files to svg in the current directory
#coding: utf-8
import os
import subprocess
files = os.listdir(".")
for f in files:
root, ext = os.path.splitext(f)
if ext == ".eps":
@tos-kamiya
tos-kamiya / manuscript.tex
Last active August 29, 2015 14:00
template to write latex document in markdown
% reference: http://qiita.com/mountcedar/items/e7603c2eb65661369c3b
% $ pandoc readme.md -o readme.tex
% or $ kramdown -o latex readme.md > readme.tex
% $ platex manuscript.tex
% $ dvipdfmx manuscript.dvi
%\documentclass[11pt,a4paper,twocolumn]{jarticle}
\documentclass[11pt,a4paper]{jarticle}
\usepackage{amssymb,amsmath}
@tos-kamiya
tos-kamiya / q7.py
Last active August 29, 2015 14:01
brute force solution for a math question
#coding: utf-8
import sys
import itertools
write = sys.stdout.write
nums = [i for i in range(1, 9+1)]
for hidden in itertools.combinations(nums, 2):
@tos-kamiya
tos-kamiya / AB.java
Created June 3, 2014 11:24
Jsonic library sample
package jsonictest;
public class AB {
private int a;
private String b;
public AB() { // 必要
}
public AB(int a, String b) { // 任意
@tos-kamiya
tos-kamiya / GsonShow.java
Created June 6, 2014 05:58
Gsonの使い方
package gsonshow;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import com.google.gson.Gson;
public class GsonShow {
@tos-kamiya
tos-kamiya / amida.py
Created June 20, 2014 02:12
Amida-kuji (ladder lottery)
#coding: utf-8
import os
import random
def write_u(u):
os.sys.stdout.write(u.encode("utf-8"))
no_beam = u"\u2502"
beam_right = u"\u251C"
@tos-kamiya
tos-kamiya / remote_copy_exec.sh
Created June 25, 2014 01:45
copy file and do command in remote
#!/bin/bash
# configuration
source ./remote_copy_exec.config
# check sshass command installed
if ! type "sshpass" > /dev/null 2>&1; then
echo "command not found: sshpass"
exit 1
fi
@tos-kamiya
tos-kamiya / mlessdef.bashrc
Last active August 29, 2015 14:03
mless, less-style markdown viewer
function mless() {
pandoc -s -f markdown -t man $1 | man -l -
}
# reference: http://stackoverflow.com/questions/7599447/less-style-markdown-viewer-for-unix-systems
@tos-kamiya
tos-kamiya / Queequeg-installation.sh
Last active August 29, 2015 14:03
[Ubuntu 14.04 Desktop] Queequeg (English grammar checker) installation
# Download Queequeg from http://queequeg.sourceforge.net/index-e.html
# Unzip it in some directory
$ sudo apt-get install wordnet
$ cd (top directory of Queequeg)
$ make dict WORDNETDICT=/usr/share/wordnet/
# Use queequeg as follows
# $ qq -Wall -t manuscript.tex
# or