Skip to content

Instantly share code, notes, and snippets.

View rummelonp's full-sized avatar
🐈‍⬛
ニャーン

Kazuya Takeshima rummelonp

🐈‍⬛
ニャーン
View GitHub Profile
@rummelonp
rummelonp / kani_cream_croquette.rb
Created November 8, 2021 12:26
カニクリームコロッケ
require 'optparse'
require 'ostruct'
params = OpenStruct.new(count: 1)
opt = OptionParser.new
opt.on('-n INT') { |v| params.count = v.to_i }
opt.parse!(ARGV)
params.count.times do
@rummelonp
rummelonp / _sqldef
Last active August 7, 2021 00:20
[WIP] sqldef の zsh 補完を作りたい
#compdef mysqldef psqldef mssqldef sqlite3def
# ------------------------------------------------------------------------------
# Copyright (c) 2021 Kazuya Takeshima
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@rummelonp
rummelonp / adb_mult
Last active August 5, 2021 07:23
複数 Android 端末繋いでる時にまとめて adb 発行するやつ
#!/bin/sh
declare -a devices=($(adb devices | sed '1,1d' | awk '{ print $1 }'))
for device in ${devices[@]}; do
declare cmd="adb -s ${device} ${@}"
echo "${cmd}"
eval "${cmd}"
done
@rummelonp
rummelonp / Makefile
Last active August 6, 2021 22:06
make で雑にデプロイするやつ
SRC = $(CURDIR)/
DEST = user@host:/path/to/
EXCLUDES = .git config log vendor
OPTIONS = -razv --delete
EXCLUDE_OPTIONS = $(foreach path,$(EXCLUDES),--exclude=$(path))
.PHONY: push push-force pull pull-force
all:
@rummelonp
rummelonp / Makefile
Created December 11, 2020 14:01
PlantUML で仕様書書いてビルドする的なやつの Makefile
SOURCES = $(shell find *.puml)
TARGETS = $(SOURCES:%.puml=%.svg)
k := $(if $(shell which plantuml),,$(error "No plantuml executable in PATH"))
all: clean $(TARGETS)
%.svg: %.puml
cat $< | plantuml -tsvg -pipe > $@
@rummelonp
rummelonp / deploy
Last active August 5, 2020 07:45
eb deploy と eb setenv を同時にやるラッパースクリプト
#!/usr/bin/env python
import argparse
from ebcli.core import fileoperations, io
from ebcli.lib import aws, elasticbeanstalk, utils
from ebcli.operations import commonops, envvarops
try:
parser = argparse.ArgumentParser(usage='deploy [environment_name] [--revision REVISION] [--timeout TIMEOUT]')
parser.add_argument('environment_name', action='store', nargs='?', default=None, type=str)
@rummelonp
rummelonp / ssh_config_updater
Last active April 23, 2020 11:23
EC2 の踏み台の .ssh/config 更新するクン
#!/usr/bin/env bash
aws --region=ap-northeast-1 ec2 describe-instances \
--query 'Reservations[*].Instances[*].{Name:Tags[?Key==`Name`]|[0].Value,Instance:InstanceId,Ip:PrivateIpAddress}' \
| jq '.[] | .[]' \
| jq --raw-output --slurp 'sort_by(.Name) | .[] | select(.Ip != null) | "Host " + .Name + "-" + .Instance, " HostName " + .Ip, ""' \
> /home/ec2-user/.ssh/config
{
"extends": "tslint:latest",
"rules": {
"array-type": [true, "generic"],
"arrow-parens": [true, "ban-single-arg-parens"],
"curly": [true, "ignore-same-line"],
"interface-name": false,
"max-classes-per-file": false,
"max-line-length": [true, 140],
"member-access": false,
@rummelonp
rummelonp / typescript.js
Last active January 9, 2019 11:19
nuxt 用の ts && tslint の設定
module.exports = function() {
this.nuxt.options.extensions.push('ts')
this.extendBuild(config => {
config.module.rules.push(
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/]
#!/usr/bin/env ruby
puts ARGV.join(' ').codepoints.map { |cp|
if ('A'..'Z').flat_map(&:codepoints).include?(cp)
cp + '𝘼'.codepoints.first - 'A'.codepoints.first
elsif ('a'..'z').flat_map(&:codepoints).include?(cp)
cp + '𝗮'.codepoints.first - 'a'.codepoints.first
else
cp
end