Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"net/http"
"os"
"strings"
"github.com/gin-gonic/gin"
"github.com/winebarrel/ddcost"
@winebarrel
winebarrel / kanmu-advent-calendar-2021-12-06.md
Last active June 11, 2023 04:16
goth-esaを作った話とおすすめのSFマンガ

これはカンムアドベントカレンダー2021の6日目です。 昨日は@hiroakisさんの記事でした。

goth-esaを作った話

yktr

弊社は情報共有ツールとしてesaを使っています。 esaはシンプルで悪くないんですが自分は、前職での情報共有ツールの体験から「この手のツールははてなブログのように記事を展開して表示してほしい」と常々考えています。 一応、esa運営に機能要望としてフィードバックしてみたものの、実装されるかわからない…ので自分でツールを作成してみました。

@winebarrel
winebarrel / kinesis_client.rb
Created December 22, 2013 10:29
Kinesis Client
require 'json'
require 'openssl'
require 'net/http'
require 'net/https'
require 'time'
require 'stringio'
require 'zlib'
module Kinesis
class Client
@winebarrel
winebarrel / pg_show_grants.sql
Last active July 12, 2022 00:28
show grants for PostgreSQL
select
pg_user.usename,
t1.nspname,
t1.relname,
relacl.privilege_type,
relacl.is_grantable
from (
select
pg_namespace.nspname,
pg_class.relname,
@winebarrel
winebarrel / db.r6g-test.md
Last active April 7, 2021 05:16
https://github.com/winebarrel/qlap を使ったdb.r6g.largeとdb.r5.largeの性能比較
@winebarrel
winebarrel / drone-template.rb
Created March 30, 2014 13:19
Drone on AWS
Parameters do
ImageId do
Type "String"
# http://cloud-images.ubuntu.com/precise/current/
# ap-northeast-1; 64-bit; ebs
Default "ami-1f334f1e"
end
InstanceType do
Type "String"
@winebarrel
winebarrel / tiny_mysql.rb
Last active January 20, 2017 08:25
https://goo.gl/HPNOeb sha1: 3149baf94ad92fc4254e4864d5b4faa53dc191b0
require 'open3'
class TinyMysql
attr_reader :mysql_command
attr_reader :defaults_extra_file
attr_reader :host
attr_reader :port
attr_reader :username
attr_reader :database
CREATE TABLE games (
author STRING HASH,
game_id NUMBER RANGE,
INDEX game-type-id-index (game_type_id NUMBER) ALL,
GLOBAL INDEX game-title-index (title STRING, version NUMBER) ALL
) read=4 write=4
@winebarrel
winebarrel / wrap.rb
Created February 7, 2016 06:20
Usage: wrap.rb any.txt 30
#!/usr/bin/env ruby
trap('PIPE', 'EXIT')
filnum = ARGV[0]
col = Integer(ARGV[1])
File.read(filnum).lines.each do |line|
state = 0
print line.split(//).slice_before {|ch|