Skip to content

Instantly share code, notes, and snippets.

  • ブログを書く 簡潔にまとめる 1週間に1つ (2020年6月16日)
    • アウトプットを増やす
    • 自分の考えを言語化する

手順

  1. 両耳同時に長押ししてオフ
  2. 両耳同時に長押ししてオン => そのまま長押しし続けて2回目のポンポンポッポンまで押し続ける
  3. ケースにしまって同時に出す => ピロリロリンがなったら右耳ペアリング

参考情報

  1. https://youtu.be/6MYv-HKMipE

ざっくりapplyを実行したときに起きていること

  • gratanのコマンド本体は、 bin/gratan

  • apply の本体は、lib/gratan/client.rb にある Client#apply

  • 現在のユーザーやテーブルへの権限付与状態は、lib/gratan/exporter.rb にある、Exporter` が取得してきている。 client.rbにある walk_*で、Expoterが取得してきた現在の状態と、gratanの定義ファイルで指定されている内容を 比較してユーザー作成や権限付与を行っている。

@fukajun
fukajun / update_pdf_size.rb
Created May 28, 2019 14:46
Convert pdf size
require 'combine_pdf'
#require 'prawn'
def crop(page, x1, y1, x2, y2)
size = page.page_size
x1_new = size[0] - x1
y1_new = size[1] - y1
x2_new = size[2] + x2
y2_new = size[3] + y2
page.mediabox = [x1_new, y1_new, x2_new, y2_new]

Setup

envchain --set isucon IKA_USER IKA_HOSTS

IKA_USER : fukajun

IKA_HOSTS : isu1,isu2,isu3

config

{"regions":[{"id":"us-east-1","name":"US East","location":"N. Virginia"},{"id":"us-east-2","name":"US East","location":"Ohio"},{"id":"us-west-1","name":"US West","location":"N. California"},{"id":"us-west-2","name":"US West","location":"Oregon"},{"id":"ap-south-1","name":"Asia Pacific","location":"Mumbai"},{"id":"ap-northeast-2","name":"Asia Pacific","location":"Seoul"},{"id":"ap-southeast-1","name":"Asia Pacific","location":"Singapore"},{"id":"ap-southeast-2","name":"Asia Pacific","location":"Sydney"},{"id":"ap-northeast-1","name":"Asia Pacific","location":"Tokyo"},{"id":"ca-central-1","name":"Canada","location":"Central"},{"id":"eu-central-1","name":"EU","location":"Frankfurt"},{"id":"eu-west-1","name":"EU","location":"Ireland"},{"id":"eu-west-2","name":"EU","location":"London"},{"id":"eu-west-3","name":"EU","location":"Paris"},{"id":"sa-east-1","name":"South America","location":"São Paulo"}],"consoleHomeServiceCategoriesByColumn":[["compute","storage","database","migration","networking","developer_tools"],
@fukajun
fukajun / limit_worker_sample.js
Created August 24, 2017 05:54
Limit concurency count on javascript
var list = []
for(i = 0; i < 200; i++) {
list.push(i)
}
var semaphore = [true, true, true, true, true, true]
var uploadImage = function(num, callback) {
setTimeout(function() {
console.log('upload', num)
callback()
}, 2000)
curl https://api.github.com/repos/fukajun/245cloud-app/releases\?access_token\=$GITHUB_PERSONAL_TOKEN | vim -
class User < ActinveRecord::Base
# address = '1540022 tokyo aa street
Address = Struct.new(:zip, :street)
before_save :rebuild_address
def address_object
@address_object ||= Address.new(address[0..5], address[6..-1])
end
def rebuild_address
address = @address_object.zip + ...
end
@fukajun
fukajun / YAPC2105schedule.js
Last active August 29, 2015 14:27
YAPC のスケージュールのページでchrome developperツールから流すとハイライトできるようになります。( http://yapcasia.org/2015/talk/schedule?date=2015-08-21 ) だからなに?
var render = function() {
$('.talk').css('background-color', 'white')
result = ''
Object.keys(list).map(function(id) {
var $el = $('.talk').has('#' + id)
$el.css('background-color', 'pink')
result += $el.find('.title').text() + '\n'
})
console.log(result)
localStorage.wanted = JSON.stringify(list);