Skip to content

Instantly share code, notes, and snippets.

View ksoda's full-sized avatar
👯‍♀️
I may be slow to respond.

Ken Sonoda ksoda

👯‍♀️
I may be slow to respond.
  • Tokyo
View GitHub Profile
@ksoda
ksoda / file
Created May 3, 2023 14:52
test
‎‎​
@ksoda
ksoda / openpgp.md
Last active February 12, 2023 12:40

openpgp4fpr:3998E3DE9E1C948D394A0154371F2E5A0E0B0BE6

@ksoda
ksoda / keybase.md
Last active January 29, 2023 19:19
keybase.md

Keybase proof

I hereby claim:

  • I am ksoda on github.
  • I am kensono (https://keybase.io/kensono) on keybase.
  • I have a public key whose fingerprint is 444F 2B4E 46D0 04B0 99F8 B114 D227 5094 0348 76CE

To claim this, I am signing this object:

psql -U postgres -h localhost \
-XAtc "SELECT tablename FROM pg_catalog.pg_tables where schemaname='public'" | while read table
do psql -U postgres -h localhost \
-c "\copy (SELECT * FROM $table) to $table.csv with csv header"
done
class NoPoopInString < Base
extend AutoCorrector
MSG = 'Where did you learn that?'
def on_str(node)
bad = '💩'
return unless node.source.include?(bad)
add_offense(node) do |corrector|
corrector.replace(node, node.source.tr(bad, '🌈'))
end
begin
require 'bundler/inline'
rescue LoadError => e
warn 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# frozen_string_literal: true
class SimpleKvs # :nodoc:
def self.call(file_name)
raf = File.open(file_name, 'r+')
new(raf)
end
def initialize(raf)
@raf = raf
@ksoda
ksoda / _main.md
Last active July 24, 2020 15:51
実践的な例 Alloy part 3

Alloy part 3

前回の続き。

ホテルの客室施錠

錠前は次の性質を持つ。

  • 現在の鍵の組み合わせを保持する
  • 疑似乱数を生成する(フィードバックレジスタ)
@ksoda
ksoda / asdf.go
Created January 13, 2020 15:23
Install a specific version of a package
//usr/bin/env go run "$0" "$@"; exit "$?"
package main
import (
"fmt"
"os"
"github.com/codeskyblue/go-sh"
)
@ksoda
ksoda / scroll-sync.js
Last active February 9, 2020 07:56 — forked from hogashi/scroll-sync.js
scroll original window -> new window will be scrolled synchronously
//javascript:
(() => {
const mkDebounce = fn => {
let timeoutId;
let resolves = [];
return function(...args) {
return new Promise(resolve => {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
timeoutId = null;