Skip to content

Instantly share code, notes, and snippets.

View ShigekiKarita's full-sized avatar
🌴
I may be slow to respond.

Shigeki Karita ShigekiKarita

🌴
I may be slow to respond.
View GitHub Profile
@ShigekiKarita
ShigekiKarita / convet_flac2mp3.sh
Last active August 29, 2015 14:17
FLAC to MP3 converter
# convert extension
mv_ext() {
for nm in *.${1}; do
mv $nm ${nm%.${1}}.${2};
done
}
# ffmpeg required
flac2mp3() {
1=${1:-"128"}
@ShigekiKarita
ShigekiKarita / cublas_wrapper.hpp
Last active August 29, 2015 14:19
easy cuBLAS macro
#include <cublas_v2.h>
namespace detail {
template <typename Dtype, typename Scalar>
using if_ = typename std::enable_if<
std::is_same<Dtype, Scalar>::value, cublasStatus_t>::type;
#define CUBLAS_FACTORY(funcname) \
template <typename Dtype, typename ... Args> \
(* Boolean *)
Inductive bool : Type :=
| true : bool
| false : bool.
Definition negb (b : bool) : bool :=
match b with
| true => false
| false => true
end.
Require Export Basics.
Module NatList.
Inductive natprod: Type :=
pair : nat -> nat -> natprod.
Definition fst (p: natprod): nat :=
match p with pair x y => x end.
Definition snd (p: natprod): nat :=
@ShigekiKarita
ShigekiKarita / gradient_clip.py
Created July 22, 2015 11:15
gradient_clip.py
from numbers import Number
from chainer import cuda
from chainer import function
from chainer.utils import type_check
import numpy
class GradientClip(function.Function):
def __init__(self, lower, upper):
# from https://github.com/pfnet/chainer/blob/master/tests/functions_tests/test_split_axis.py
# "setUp()" modified and "@condition.retry()" added
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
# from https://github.com/pfnet/chainer/blob/master/tests/functions_tests/test_split_axis.py
# "setUp()" modified and "@condition.retry()" added
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
(setenv "PATSHOME" (concat (getenv "HOME") "/tool/ats/ATS2-Postiats-0.2.1"))
;; https://raw.githubusercontent.com/mrd/ats2-mode/master/ats2-mode.el
(require 'ats-mode)
(setq auto-mode-alist
(append '(("\\.dats$" . ats-mode))
auto-mode-alist))
(add-hook 'ats-mode-hook
'(lambda ()
@ShigekiKarita
ShigekiKarita / cp_bibpdf.zsh
Last active September 2, 2015 06:07
Script to copy PDFs described in Mendeley's bibtex
#!/usr/bin/env zsh
function usage {
cat <<EOF
Note:
cp_bibpdf copys PDFs described in Mendeley's bibtex
Usage:
cp_bibpdf {src.bib} {dst_dir}
EOF
gistup