Skip to content

Instantly share code, notes, and snippets.

Avatar

Kazuya Takeshima mitukiii

View GitHub Profile
@mitukiii
mitukiii / deploy
Last active Aug 5, 2020
eb deploy と eb setenv を同時にやるラッパースクリプト
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)
@mitukiii
mitukiii / ssh_config_updater
Last active Apr 23, 2020
EC2 の踏み台の .ssh/config 更新するクン
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,
@mitukiii
mitukiii / typescript.js
Last active Jan 9, 2019
nuxt 用の ts && tslint の設定
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
@mitukiii
mitukiii / amazon-calc.js
Last active Jun 13, 2017 — forked from polamjag/amazon-calc.js
Amazon で使った金額の合計を出す奴 (2014-2016 年バージョン) (月枚に出すよう変更)
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
View now_browsing.js
!function(){var t=document.getSelection().toString(),o=(t?'"'+t+'" / ':"Now Browsing: ")+document.title+" "+location.href,e="tweetbot:///post?text="+encodeURIComponent(o);location.href=e}();
You can’t perform that action at this time.