View 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 > $@ |
View deploy
#!/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) |
View ssh_config_updater
#!/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 |
View tslint.json
{ | |
"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, |
View typescript.js
module.exports = function() { | |
this.nuxt.options.extensions.push('ts') | |
this.extendBuild(config => { | |
config.module.rules.push( | |
{ | |
test: /\.tsx?$/, | |
loader: 'ts-loader', | |
options: { | |
appendTsSuffixTo: [/\.vue$/] |
View strong.rb
#!/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 |
View amazon-calc.js
// Amazon で使った金額の合計を出す奴 | |
// | |
// 使い方: | |
// 1. 全部コピーする (右上の Raw をクリックした先でやるのが楽) | |
// 2. Amazon の注文履歴ページ ( https://www.amazon.co.jp/gp/css/order-history/ ) を開く | |
// 3. F12 または 右クリ→要素の検証 とかで出てくる開発者ツールのコンソール (JavaScript REPL) にペースト | |
// 4. エンターで実行 | |
// (Firefox はなんか allow pasting とタイプしろみたいなことを言われるので従う) | |
// 5. しばらく待つと alert で合計金額を表示 | |
// |
View application_service.rb
class ApplicationService | |
include ActiveModel::Model | |
def submit(params = {}) | |
params.each do |key, value| | |
self.public_send("#{key}=", value) | |
end | |
self | |
end |
View pict.rb
require 'formula' | |
class Pict < Formula | |
head do | |
url "https://github.com/Microsoft/pict.git" | |
end | |
def install | |
system "make" | |
bin.install "pict" => "pict" |
View markdown_link.js
!function(){var t=document.getSelection().toString(),o=(t?t:document.title);prompt("","["+o+"]("+location.href+")")}(); |
NewerOlder