Skip to content

Instantly share code, notes, and snippets.

View smagch's full-sized avatar
🗾
Japan

Shimaguchi Tomoya smagch

🗾
Japan
View GitHub Profile
@smagch
smagch / convert_4k.sh
Created May 12, 2020 13:44
convert multiple movies
#!/usr/bin/env bash
distdir="$(pwd)/dist$RANDOM$RANDOM"
mkdir "$distdir"
for input in "$@"; do
base=$(basename "$input")
output="$distdir/${base,,}"
ffmpeg -i "$input" \
@smagch
smagch / encode_4k.sh
Last active March 20, 2020 17:48
ffmpeg for a6400
# ffmpeg -i input.mp4 -crf 28 -b:a 128k -color_range 1 -color_trc arib-std-b67 -color_primaries bt2020 -colorspace bt2020nc output_28.mp4
# ffmpeg -i output28.mp4 -c copy -map 0 -segment_time 00:01:00 -reset_timestamps 1 -f segment output_%03d.mp4
ffmpeg -i input.mp4 -crf 28 -b:a 128k -color_range 1 -color_trc arib-std-b67 -color_primaries bt2020 -colorspace bt2020nc -segment_time 60 -f segment -reset_timestamps 1 output_%03d.mp4
@smagch
smagch / index.html
Created November 26, 2019 04:14
open/collapse for an element with `height: auto`
<html>
<head>
<style>
.item {
display: block;
overflow: hidden;
}
.head {
height: 30px;
line-height: 30px;
@smagch
smagch / index.html
Created October 16, 2019 15:59
iOS focus test
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>iOS focus Test</title>
<style>
.modal {
transition: opacity 0.3s;
@smagch
smagch / null_int_64.go
Created October 6, 2014 12:29
Custom sql.NullInt64 that handles json marshalling nicely, http://play.golang.org/p/w8VzxLGd-f
package main
import (
"database/sql"
"encoding/json"
"errors"
"log"
"strconv"
)
@smagch
smagch / hook.js
Last active June 28, 2019 16:32
react hooks: resize check
import { useState, useEffect } from 'react';
import { debounce } from 'lodash';
export const useResizeState = () => {
const [ resizing, setResizing ] = useState(false);
useEffect(() => {
const handleResizeEnd = debounce(() => {
setResizing(false);
}, 300);
@smagch
smagch / README.md
Last active March 21, 2019 13:18
CloudFormation: Postgres with default VPC spike
aws cloudformation create-stack --stack-name hogehoge --template-body file://conf.json --region ap-northeast-1 --parameters file://param.json
@smagch
smagch / slide.html
Last active March 4, 2019 09:25
Simple slider: should fix margin
<html>
<style>
html, body {
margin: 0;
}
.hidden-wrapper {
overflow: hidden;
}
.wrapper {
width: 100%;
@smagch
smagch / README.md
Last active February 18, 2019 08:17
Golang: map vs struct loopkup benchmark
BenchmarkStruct1	50000000	        41.1 ns/op
BenchmarkMap1	50000000	        43.5 ns/op
BenchmarkStruct2	50000000	        42.8 ns/op
BenchmarkMap2	50000000	        44.4 ns/op
BenchmarkStruct3	50000000	        45.3 ns/op
BenchmarkMap3	50000000	        37.0 ns/op
BenchmarkStruct4	50000000	        42.2 ns/op
BenchmarkMap4	50000000	        37.3 ns/op
@smagch
smagch / coderdojo_study_asahikawa.md
Created September 21, 2012 08:22
CoderDojo勉強会

CoderDojo勉強会・打ち合わせ

9月23日に[まちこみゅ]のフリースペースで、勉強会をしました。4人のメンターが参加。

やる内容

まず、HTML/CSS/JavaScriptからスタート。 CSSDeckのオンラインコラボを4人で試してみる。かなり有効なツール。 課題として、何かやりたい、という目標もまだない初心者が来た場合のためには何をするのか、あらかじめ用意が必要。 CSSDeckなどに上がってるものは、結構難しいものが多いので、初心者向けのひな形を探しておくか、用意しておく必要がある。