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 / snakeoil.sh
Created December 19, 2012 07:23
Generate snakeoil SSL certificates on Debian
sudo apt-get install ssl-cert
sudo make-ssl-cert generate-default-snakeoil
sudo usermod --append --groups ssl-cert yyuu
ls -l /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key
@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 / gist:1569253
Created January 6, 2012 06:01
df in python on Linux
#!/usr/bin/env python
from __future__ import with_statement
import contextlib
import os
import sys
print "Filesystem\tMounted on\tUse%\tIUse%"
with contextlib.closing(open('/etc/mtab')) as fp:
for m in fp:
@yyuu
yyuu / packages2json.rb
Created July 18, 2012 03:00
Convert Debian's Packages.gz into JSON format.
#!/usr/bin/env ruby
require 'fileutils'
require 'json'
require 'strscan'
require 'zlib'
def parse(file)
case file
when /\.bz2$/
@yyuu
yyuu / copy_subdir.rb
Created April 18, 2012 09:42
a capistrano strategy to deploy sub-directory in repository with "copy" strategy
#!/usr/bin/env ruby
#
# a capistrano strategy to deploy sub-directory in the repository.
# this is a stuff like "remote_cache_subdir" strategy described in following page,
# but based on "copy" strategy of capistrano deploy recipe.
#
# http://stackoverflow.com/questions/29168/deploying-a-git-subdirectory-in-capistrano
#
require 'capistrano'
@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",
downloadService.post('hudson.tools.JDKInstaller',{
"data": [
{
"name": "JDK 8",
"releases": [ {
"files": [
{
"filepath": "http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.tar.gz",
"name": "jdk-8u5-linux-i586.tar.gz",
"title": "Linux x86"
@yyuu
yyuu / pymysql.monitor.py
Created April 17, 2012 09:27
mon monitor plugin to test mysql services
#!/usr/bin/env python
from __future__ import with_statement
import contextlib
import logging
import MySQLdb
import optparse
import os
import sys
@yyuu
yyuu / find-orphaned-snapshots.py
Created February 17, 2012 08:35
find snapshot which is not referenced from any AMIs
#!/usr/bin/env python
#
# find snapshots which is not referenced from any AMIs
#
import boto.ec2
import boto.ec2.image
import boto.exception
import os
import re
@yyuu
yyuu / Makefile
Created February 8, 2012 04:09 — forked from anonymous/Makefile
openssl private CA management script
OPENSSL = openssl
DAYS = -days 3652
CADAYS = -days 3652
REQ = $(OPENSSL) req
CA = $(OPENSSL) ca
VERIFY = $(OPENSSL) verify
X509 = $(OPENSSL) x509
# must be absolute path
CATOP = $(PWD)/ca