Skip to content

Instantly share code, notes, and snippets.

On vacation

Hironao OTSUBO motemen

On vacation
Block or report user

Report or block motemen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
motemen / git-remove-old-branches
Created Dec 29, 2011
remove old remote git branches interactively
View git-remove-old-branches
git fetch
for branch in `git branch --remote --merged origin/master | sed 's/ *origin\///' | grep -v ' ' | grep -v 'master$'`
MERGE_EPOCH=$(git --no-pager log -1 --pretty='%ct' $(git merge-base origin/master origin/$branch))
CURRENT_EPOCH=$(git --no-pager log -1 --pretty='%ct' origin/master)
if [ $(expr $(expr $CURRENT_EPOCH - $MERGE_EPOCH) / 60 / 60 / 24) -ge 14 ]; then
motemen /
Last active May 19, 2019
Shell script to setup/push GitHub pages
# usage: push-gh-pages DIRECTORY # DIRECTORY is where GitHub pages contents are in (eg. build)
# LICENSE: Public Domain
set -e
remote=$(git config remote.origin.url)
described_rev=$(git rev-parse HEAD | git name-rev --stdin)
View textlint-asciidoctor.rb
#!/usr/bin/env ruby
# textlint-asciidoctor -r ./macro.rb -T code,dfn index.adoc
require 'asciidoctor'
require 'cgi'
require 'json'
require 'optparse'
require 'tempfile'
motemen /
Created Mar 9, 2018
Shell script to run a Go program by package path
set -e
pkg="$1"; shift
files=($(go list -f '{{range .GoFiles}}{{$.Dir}}/{{.}}{{end}}' "$pkg"))
go run -exec "bash -c 'shift; exec \"\$0\" \"\$@\"'" "${files[@]}" -- "$@"
motemen /
Created Apr 29, 2012
Commit a file to another branch
if [ -z "$BRANCH" ]; then
echo "Usage: $0 <branch> <file>"
exit 1
$] = 5.008008
$URI::VERSION = 1.71
use strict;
use warnings;
use HTTP::Tiny;
use JSON;
use App::cpanminus::fatscript;
my $dist = shift;
my $dep = shift;
my $version = shift;
View exercise-a.3.4.als
sig Person {
shaken: set Person,
partner: Person
fact partnerProperties {
partner = ~partner
no p: Person | p in p.partner
View metacpan-query.json{%20%22query%22:%20{%20%22filtered%22:%20{%20%22query%22:%20{%20%22match_all%22:%20{}%20},%20%22filter%22:%20{%20%22and%22:%20[%20{%20%22term%22:%20{%20%22distribution%22:%20%22Net-CIDR-MobileJP%22%20}%20},%20{%20%22nested%22:%20{%20%22path%22:%20%22dependency%22,%20%22filter%22:%20{%20%22and%22:%20[%20{%20%22term%22:%20{%20%22dependency.module%22:%20%22WWW::MobileCarrierJP%22%20}%20},%20{%20%22term%22:%20{%20%22dependency.version_numified%22:%200%20}%20}%20]%20}%20}%20}%20]%20}%20}%20}%20}
You can’t perform that action at this time.