Skip to content

Instantly share code, notes, and snippets.

View yyuu's full-sized avatar
👽
Working from home

Yamashita, Yuu yyuu

👽
Working from home
View GitHub Profile
@yyuu
yyuu / circle.rb
Last active December 7, 2019 13:10
A simple script to convert Circle CI configurations from circle.yml (1.0) to .circleci/config.yml (2.0)
#!/usr/bin/env ruby
require "fileutils"
require "shellwords"
require "yaml"
CIRCLE1_DEFAULT_CACHE_DIRECTORIES = [
"vendor/bundle",
"~/.m2",
"~/.bundle",
#!/usr/bin/env bash
#
# slice.sh - split stdin lines into chunks and run given commands
#
# Examples: Run given commands once per 2 lines
#
# ```sh
# { echo foo
# echo bar
# echo baz
@yyuu
yyuu / install.sh
Last active February 3, 2016 07:34
ChefDK installer
#!/bin/sh
set -e
# default ChefDK version
chefdk_version="0.10.0-1"
while [ $# -gt 0 ]; do
case "$1" in
"-v" )
@yyuu
yyuu / run.sh
Created December 28, 2015 01:26
runit's run script for JupyterHub
#!/usr/bin/env bash
set -e
set -x
JUPYTERHUB_HOME="/srv/jupyterhub"
shopt -s nullglob
for node_module_bin in "${JUPYTERHUB_HOME}/current/node_modules/"*"/bin"; do
PATH="${node_module_bin}:${PATH}"
@yyuu
yyuu / iam-grep-user.sh
Created December 24, 2015 09:11
A bash script to do grep against AWS IAM users
#!/usr/bin/env bash
set -e
AWSCLI_OPTIONS=""
tmpdir="$(mktemp -d "${TMP:-/tmp}/${BASH_SOURCE##*/}.XXXXXXXX")"
on_exit() {
rm -fr "${tmpdir}"
@yyuu
yyuu / .gitignore
Last active April 27, 2016 04:58
Dockerfile to build CRuby for heroku-buildpack-ruby
*.swo
*.swp
/cedar
/cedar-12
/cedar-14
@yyuu
yyuu / json2msgpackgz.rb
Created June 25, 2015 05:00
json2msgpackgz.rb
#!/usr/bin/env ruby
require "json"
require "msgpack"
require "tempfile"
require "zlib"
io = Tempfile.new(File.basename($0))
gzip = Zlib::GzipWriter.new(io)
packer = MessagePack::Packer.new(gzip)
ARGF.each do |s|
record = JSON.parse(s)
@yyuu
yyuu / pem2jks.sh
Last active May 9, 2017 12:58
pem2jks.sh
#!/usr/bin/env bash
#
# pem2jks.sh - convert bundled PEM certificate to JKS format
#
# Special thanks to Justin Ludwig about his article on converting PEM to JKS.
# http://blog.swwomm.com/2015/02/importing-new-rds-ca-certificate-into.html
#
set -e
This file has been truncated, but you can view the full file.
/var/folders/rc/_9kglbjs651431bbh2736s300000gn/T/python-build.20141227152802.9648 ~
Downloading Python-3.4.1.tgz...
HTTP/1.1 200 OK
Date: Sat, 27 Dec 2014 06:28:03 GMT
Server: GitHub.com
Content-Type: application/octet-stream
Last-Modified: Tue, 04 Nov 2014 09:32:24 GMT
Expires: Sat, 27 Dec 2014 04:57:53 GMT
Cache-Control: max-age=600
Content-Length: 19113124
@yyuu
yyuu / match.go
Last active August 29, 2015 14:04
A utility to test Go's filepath.Match to write .dockerignore
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
if len(os.Args) < 2 {