Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# http://kameya-z.way-nifty.com/blog/2010/10/ffmpegflvmp4-a4.html
file_name=$1
ffmpeg -threads 4 -y -i "${file_name}" -vcodec copy -acodec copy "${file_name/.flv/m4v}"
# https://qiita.com/massie_g/items/a2bcfac4fed66b1b0717
FROM ubuntu:18.04
#
# -- if you are using docker behind proxy, please set ENV --
#
#ENV http_proxy "http://proxy.yourdomain.com:8080/"
#ENV https_proxy "http://proxy.yourdomain.com:8080/"
# :eyes: https://github.com/tgagor/docker-jpegtran
function jpegtran_docker {
[ $(docker images jpegtran | wc -l) != 2 ] && return 1 # ahead of this, build jpegtran with https://github.com/tgagor/docker-jpegtran.git
local file=$1
[ -z $file ] && return 1
local filedir=$(dirname ${file})
[ ${filedir} = "." ] && filedir=$(pwd)
@yu81
yu81 / 街区レベル位置参照情報.sh
Created November 16, 2017 07:42
http://nlftp.mlit.go.jp/isj/ からダウンロード可能なCSVを全て取得。
#!/bin/bash
for i in $(seq 1 47); do
wget http://nlftp.mlit.go.jp/isj/dls/data/15.0a/$(printf "%02d" $i)000-15.0a.zip
wget http://nlftp.mlit.go.jp/isj/dls/data/10.0b/$(printf "%02d" ${i})000-10.0b.zip
done
// go 1.7.4 以下のベンチマークコードで go test -v -bench -benchmem を実行
func BenchmarkMatchFooBarBaz(b *testing.B) {
r := regexp.MustCompile("^foo")
const input = "foo"
b.ResetTimer()
for i := 0; i < b.N; i++ {
r.MatchString(input)
}
}
// -> BenchmarkMatchFoo-4 10000000 230 ns/op 0 B/op 0 allocs/op
<?php
// PHP 7.0.8
$count = 1000000;
$start = microtime(true);
for($i = 0;$i < $count; $i++) {
preg_match("/^foo/", "foo");
}
$end = microtime(true);
echo 1000000000 * (($end - $start) / $count) . " ns/op" . PHP_EOL;
// -> 200 ns/op 程度
package api
import (
"testing"
)
const iteration = 2
func Benchmark_AppendString1(b *testing.B) {
for i := 0; i < b.N; i++ {
@yu81
yu81 / zshrc_useful.sh
Last active May 23, 2016 07:08 — forked from mollifier/zshrc_useful.sh
少し凝った zshrc
# 少し凝った zshrc
# License : MIT
# http://mollifier.mit-license.org/
########################################
# 環境変数
export LANG=ja_JP.UTF-8
path=(/opt/otto/bin ~/.apachehere/bin ~/.pyenv/shims ~/.rbenv/shims ~/bin(N-/) /usr/local/bin(N-/) /usr/local/heroku/bin ~/.composer ~/.composer/vendor/bin ~/.nodebrew/current/bin /Developer/NVIDIA/CUDA-7.0/bin ${path})
export CUDA_HOME=/usr/local/cuda
@yu81
yu81 / letsencrypt_cert_standalone.sh
Last active May 17, 2016 10:46
Semi-automation script of Let's Encrypt. https://letsencrypt.org/
#!/bin/bash -xv
letsencrypt_path=$1
if [ ! -e ${letsencrypt_path}/certbot-auto ]; then
pushd ~/
git clone https://github.com/letsencrypt/letsencrypt && [ ! -e ${letsencrypt_path}/certbot-auto ] && exit 1
popd
fi
domain_name=$2
@yu81
yu81 / month_en_to_number.sh
Created March 29, 2016 05:49
Convert Abbreviations of month in English to numbers.
sed -e "s/Jan/1/g" -e "s/Feb/2/g" -e "s/Mar/3/g" -e "s/Apr/4/g" -e "s/May/5/g" -e "s/Jun/6/g" -e "s/Jul/7/g" -e "s/Aug/8/g" -e "s/Sep/9/g" -e "s/Oct/10/g" -e "s/Nov/11/g" -e "s/Dec/12/g"