Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kuwabarahiroshi's full-sized avatar

Hiroshi Kuwabara kuwabarahiroshi

View GitHub Profile
@kuwabarahiroshi
kuwabarahiroshi / Calendar.js
Last active July 13, 2021 07:21
Vanilla JavaScript (ES6) Class that calculates monthly calendar object
export default class Calendar {
constructor(...args) {
this.date = new Date(...args);
}
get year() {
return this.date.getFullYear();
}
get month() {
@kuwabarahiroshi
kuwabarahiroshi / mov2gif
Last active March 14, 2019 04:55
Convert videos (.mov, .mp4, etc.) to animated GIF via command line. (on Mac)
#!/bin/bash
# install ffmpeg and gifsicle if not exists
which ffmpeg > /dev/null || brew install ffmpeg
which gifsicle > /dev/null || brew install gifsicle
usage () {
echo "Usage:" 1>&2
echo " mov2gif [-d delay] [-o 1|2|3] [-r frame_rate] [-w width] input_file" 1>&2
echo "" 1>&2
@kuwabarahiroshi
kuwabarahiroshi / Dockerfile
Created February 13, 2019 09:36 — forked from tylerchr/Dockerfile
Compiling V8 for alpine (link against musl)
#
# Building V8 for alpine is a real pain. We have to compile from source, because it has to be
# linked against musl, and we also have to recompile some of the build tools as the official
# build workflow tends to assume glibc by including vendored tools that link against it.
#
# The general strategy is this:
#
# 1. Build GN for alpine (this is a build dependency)
# 2. Use depot_tools to fetch the V8 source and dependencies (needs glibc)
# 3. Build V8 for alpine
@kuwabarahiroshi
kuwabarahiroshi / Gemfile
Created December 16, 2016 14:24
Optimize CarrierWave images using image_optim
gem 'carrierwave'
gem 'image_optim_rails'
gem 'image_optim_pack'
@kuwabarahiroshi
kuwabarahiroshi / setup-bare-repository-and-worktree
Created January 28, 2014 06:01
Gitのbare repositoryとworktreeを設定する一連のコマンド
mkdir project.git
cd project.git/
git init --bare
git --bare update-server-info
git config core.bare false
git config core.worktree /path/to/project
git config receive.denyCurrentBranch ignore
cat > hooks/post-receive
#!/bin/sh
git checkout -f
@kuwabarahiroshi
kuwabarahiroshi / build_signed_apk.sh
Created January 20, 2014 11:11
Androidアプリをビルドするときにantを使って署名付APKを作成するシェルスクリプト。 brewでandroid-sdkをインストールしている前提です。 署名する際にkeystoreファイルのパスワードを求められますが、expectコマンドで自動化しています。
#! /bin/bash
expect -f - <<EOD
set timeout -1
set pass "YOUR-PASSWORD"
spawn ant -f build.xml clean release -Dsdk.dir=$(brew --prefix android-sdk)
expect "(store:production.keystore):" { send "\$pass\r" }
expect "Please enter password for alias 'mykey':" { send "\$pass\r" }
expect eof
@kuwabarahiroshi
kuwabarahiroshi / makeApp.sh
Created January 20, 2014 04:30
Make standalone chrome app
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline
@kuwabarahiroshi
kuwabarahiroshi / test.rb
Created January 16, 2014 08:23
SQL statement with subquery is consistent but not atomic.
#!/usr/bin/env ruby
require 'mysql2'
#------------------------------------
# config
#------------------------------------
MYSQL_CONF = {
host: 'localhost',
username: 'root',

AWSにてS3とアクセス権限の設定

@kuwabarahiroshi
kuwabarahiroshi / Makefile
Created October 22, 2013 09:13
iOSアプリのbuild -> TestFlightアップを自動化するMakefile
.PHONY: flight build
DATETIME = $(shell date '+%Y-%m-%d_%H%M%S')
PROVISIONNING_PROFILE = AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA
BUILD = staging
default:
xcodebuild -sdk iphoneos -target appname -configuration Production -scheme appname-production build
update-bundle-version:
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion `git rev-list HEAD | wc -l`" appname/appname-Info.plist