Skip to content

Instantly share code, notes, and snippets.

@sue445
sue445 / destroy_old_droplets.rb
Created August 24, 2017 09:32
destroy_old_droplets
# via. https://github.com/itamae-kitchen/itamae/blob/v1.9.3/ci/destroy_old_droplets.rb
require 'net/https'
require 'json'
require 'time'
http = Net::HTTP.new("api.digitalocean.com", 443)
http.use_ssl = true
res = http.start do
http.get("/v2/droplets", "Authorization" => "Bearer #{ENV['DIGITALOCEAN_ACCESS_TOKEN']}")
@sue445
sue445 / rubocop_auto_correct_commit.rb
Last active April 17, 2018 07:36
`rubocop --auto-correct --only COP` and `git commit`
# `rubocop --auto-correct --only COP` and `git commit`
# Usage: ruby rubocop_auto_correct_commit.rb
require "json"
DEFAULT_ORDER = 100
# --auto-correctする時の実行順(数字が小さい方が先に実行される)
COP_ORDERS = {
# Style/UnneededPercentQはStyle/StringLiteralsのようにシングルクオーテーション優先かダブルクオーテーション優先のようなconfigがない
@sue445
sue445 / dig.log
Created June 15, 2017 02:09
dig precure.ml
$ dig precure.ml
; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.4 <<>> precure.ml
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 31687
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
@sue445
sue445 / parse_gemfile.rb
Created June 4, 2017 14:55
Gemfile中のgemの名前だけ取り出して標準出力に書き出す
# Gemfile中のgemの名前だけ取り出して標準出力に書き出す
#
# 使い方
# ruby parse_gemfile.rb /path/to/gemfile
#
# 複数のgemfileから被ってるのが多い順に表示する
# ruby parse_gemfile.rb *.gemfile | sort | uniq -c | sort -nr
# rails newした時にデフォルトで入ってるgemは除外する
EXCLUDE_GEMS = %w(
@sue445
sue445 / oss_patch.md
Last active May 19, 2017 03:41
OSSパッチ会@ESM
@sue445
sue445 / moyamoya.md
Last active May 14, 2017 06:16
#キュアぱず もやもや稼げそうな通常ステージ

ピンク

  • 3-25: もやもやx8
  • 3-36: もやもやx3
  • 3-38: もやもや製造機x1
  • 4-32: もやもや製造機x2
  • 4-34: もやもや製造機x2
  • 4-35: もやもやx9

  • 2-26: もやもや製造機x2
@sue445
sue445 / READNE.md
Last active April 11, 2019 14:29
☆5ソウルを生成するための素材の個数を計算するためのスクリプト #ブレxブレ

☆5ソウルを生成するための素材の個数を計算するためのスクリプト

ヴァルキリー

使い方

ruby calc_valkyrie.rb

実行結果(ヴァルキリーを生成するのに必要な全素材)

  • 新鮮なキノコ x 30000
  • 魔導ブラッド x 18000
@sue445
sue445 / node.yml
Created February 27, 2017 01:09
itamae + fluentd example
td-agent:
plugin:
fluent-plugin-secure-forward: "0.4.3"
fluent-plugin-multiprocess: "0.2.1"
fluent-plugin-forest: "0.3.0"
fluent-plugin-parser: "0.6.0"
fluent-plugin-record-reformer: "0.8.0"
@sue445
sue445 / say_precure.sh
Created February 20, 2017 12:13
Macにプリキュアの名前を言わせるワンライナー
curl -s https://rubicure.herokuapp.com/girls.json | jq -r ".[].girl_name" | say
@sue445
sue445 / precure_started_date.rb
Created February 2, 2017 04:02
今日が放映開始日のプリキュアを取得するワンライナー
Precure.select{ |series| series.started_date.month == Date.today.month && series.started_date.day == Date.today.day }.map(&:title)
#=> ["ハピネスチャージプリキュア!"]