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
motemen / gorun.sh
Created Mar 9, 2018
Shell script to run a Go program by package path
View gorun.sh
#!/bin/bash
set -e
pkg="$1"; shift
files=($(go list -f '{{range .GoFiles}}{{$.Dir}}/{{.}}{{end}}' "$pkg"))
go run -exec "bash -c 'shift; exec \"\$0\" \"\$@\"'" "${files[@]}" -- "$@"
View test.pl
$] = 5.008008
$URI::VERSION = 1.71
https://www.example.com?hoge=%E3%81%BB%E3%81%92
https://www.example.com?hoge=%C3%A3%C2%81%C2%BB%C3%A3%C2%81%C2%92&foo=bar
View resolvecpandeps.pl
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
http://api.metacpan.org/v0/release/_search?source={%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}
View want-kill-tree.js
var spawn = require('child_process').spawn;
var depth = process.argv[2];
if (!depth) {
var p = spawn('node', [ process.argv[1], '1' ], { stdio: 'inherit' });
setTimeout(() => {
console.log(process.pid, 'Killing child', p.pid);
p.kill();
}, 500);
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'
ERASED_TEXT = '◆◆'
View README.txt
An example simple repository.
View github-webhook-pullrequest.json
{
"action": "synchronize",
"number": 2,
"pull_request": {
"url": "https://api.github.com/repos/motemen/test-repository/pulls/2",
"id": 17160832,
"html_url": "https://github.com/motemen/test-repository/pull/2",
"diff_url": "https://github.com/motemen/test-repository/pull/2.diff",
"patch_url": "https://github.com/motemen/test-repository/pull/2.patch",
"issue_url": "https://api.github.com/repos/motemen/test-repository/issues/2",
View ghq.sbt
lazy val ghqGetDepndencies = taskKey[Unit]("""Download dependencies using "ghq get".""")
ghqGetDepndencies <<= (ivyPaths, libraryDependencies, streams) map {
(ivyPaths, libraryDependencies, s) =>
new IvyCache(ivyPaths.ivyHome).withDefaultCache(None, s.log) {
cache =>
libraryDependencies.foreach {
m =>
import org.apache.ivy.core.module.id.ModuleRevisionId
import scala.collection.JavaConversions._
You can’t perform that action at this time.