Skip to content

Instantly share code, notes, and snippets.

View masutaka's full-sized avatar

Takashi Masuda masutaka

View GitHub Profile
@masutaka
masutaka / 00tree.txt
Last active March 26, 2020 14:34
Makefiles for terraform
.
├── Makefile # (1)
└── terraform
    ├── aws
    │   ├── Makefile # (2)
    │ └── main.tf
    └── heroku
    ├── Makefile # (3)
    └── main.tf
--- Makefile.orig 2020-03-26 22:38:05.000000000 +0900
+++ Makefile 2020-03-26 22:39:57.000000000 +0900
@@ -1,9 +1,10 @@
+DIRENV := direnv
MAKE := make
TARGETS := aws heroku
define make-r
@for i in $(TARGETS); do \
- $(MAKE) -w -C terraform/$$i $(1) || exit $$?; \
@masutaka
masutaka / .rubocop.yml
Created February 25, 2020 10:50
Forbid Dir.chdir using rubocop custom cop
require:
- ./lib/rubocop/cop/hoge
@masutaka
masutaka / oneshot_base_job.rb
Created December 11, 2019 15:54
sample one-shot job on Heroku
# @abstract One-shot 関連のジョブは必ずこの class を継承し、
# キーワード引数に :global_executions を要求する #perform を実装すること
class OneshotBaseJob < ApplicationJob
class << self
# Retry the One-shot job due to the exception
#
# @param job [OneshotBaseJob] A One-shot job class to retry
# @return [void]
#
# @note See ActiveJob::Exceptions::ClassMethods#retry_on for the parameters except to `job`
@masutaka
masutaka / test.js
Last active August 10, 2019 03:13
esa.io の通常カテゴリと、Archived カテゴリを行ったり来たりするブックマークレット
if (/esa\.io\/#path=%2FArchived%2F/.test(location.href)) {
location.href = location.href.replace(/#path=%2FArchived%2F/, '#path=%2F');
} else if (/esa\.io\/#path=%2F/.test(location.href)) {
location.href = location.href.replace(/#path=%2F/, '#path=%2FArchived%2F');
}
@masutaka
masutaka / circle.yml
Created November 2, 2016 05:58
terraform apply in CircleCI
machine:
environment:
PATH: $HOME/.terraform:$PATH
TERRAFORM_VERSION: 0.7.7
dependencies:
cache_directories:
- ~/.terraform
pre:
- script/dependencies.sh
@masutaka
masutaka / export.sh
Last active May 7, 2019 03:50
Export Slack custom emoji
#!/bin/sh
# You can get on https://api.slack.com/methods/emoji.list/test
endpoint='https://slack.com/api/emoji.list?token=<SECRET>&pretty=1'
json=$(curl -s $endpoint)
keys=$(echo $json | jq -r '.emoji | keys[]')
mkdir -p images
@masutaka
masutaka / git-push.log
Created April 26, 2019 15:12
Heroku Buildpack research
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
@masutaka
masutaka / 00before.el
Last active April 24, 2019 21:30
Generate helm-github-stars-cache-file asynchronously
(defun my-lisp-load (filename)
"Load lisp from FILENAME"
(let ((fullname (expand-file-name (concat "spec/" filename) user-emacs-directory))
lisp)
(when (file-readable-p fullname)
(with-temp-buffer
(progn
(insert-file-contents fullname)
(setq lisp
(condition-case nil
# For issues
workflow "issues" {
on = "issues"
resolves = ["Add an issue to project"]
}
action "Add an issue to project" {
uses = "docker://masutaka/github-actions-all-in-one-project"
secrets = ["GITHUB_TOKEN"]