cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
curl https://gist.githubusercontent.com/labocho/f7da1dd8964d5ac50e5f399ef72973ab/raw/8e0572e6eef18536fdb129eb73de73a60685c449/mysql@5.7.rb > Formula/mysql@5.7.rb
brew install mysql@5.7
# to revert
git checkout Formula/mysql@5.7.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// webpack.config.js for Rails application | |
// Other configurations: | |
// tsconfig.json: https://gist.github.com/labocho/0afa689d18dc5b2d434ec0ff9a6673bb | |
// .eslintrc.yml: https://gist.github.com/labocho/b3665e878db2b30b79abe43d5f1e3a25 | |
// Useful scripts: | |
// "dev": "rm -rf public/packs && webpack --progress", | |
// "build": "rm -rf public/packs && webpack --mode=production", | |
// "lint": "eslint app/javascript", | |
// "lint-fix": "eslint app/javascript --fix", | |
// "watch": "webpack --progress --watch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type {VNode, VueConstructor} from "vue"; | |
import Vue from "vue"; | |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
function mountView(el: Element, component: VueConstructor, properties: any, components: any): void { | |
// eslint-disable-next-line no-new | |
new Vue({ | |
components, | |
el, | |
render: (createElement): VNode => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# h = StrictAccessor.strictify({a: 1, b: [{c: 3}]}) | |
# h[:c] # KeyError | |
# h[:b][1] # IndexError | |
module StrictAccessor | |
def self.strictify(object) | |
case object | |
when Array | |
object.map {|e| strictify(e) }.extend(self) | |
when Hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewRenderer | |
class ViewRenderingController < ActionController::Base | |
include Rails.application.routes.url_helpers | |
include ApplicationHelper | |
def protect_against_forgery? | |
false | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Usage: numbers2csv foo.numbers > foo.csv | |
require "open3" | |
require "tempfile" | |
def osascript(script, *args) | |
out, err, status = Open3.capture3("osascript", "-l", "JavaScript", "-e", script, *args) | |
unless status.success? | |
raise ScriptError, err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "logger" | |
$stdout.sync = true | |
logger = Logger.new($stdout) | |
logger.formatter = -> (severity, datetime, _progname, message) { | |
{ | |
severity: severity, | |
time: datetime.to_i, | |
}.merge(message).to_json + "\n" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark" | |
Benchmark.bm do |x| | |
x.report { | |
5.times do |i| | |
system("bundle exec itamae ssh --host=192.168.33.10 --user=itamae file_creation.rb", out: "/dev/null", err: "/dev/null") || raise | |
end | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
import os | |
# https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/with-sns.html | |
def lambda_handler(event, context): | |
req = urllib.request.Request( | |
os.environ["SLACK_WEBHOOK_URL"], | |
json.dumps({ | |
"text": event["Records"][0]["Sns"]["Subject"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo: !inherit | |
from: b.yml | |
override: | |
a: | |
b: !replace | |
d: 12345 |