Skip to content

Instantly share code, notes, and snippets.

View munisystem's full-sized avatar

Yuichi Saito munisystem

View GitHub Profile
@munisystem
munisystem / queries.yaml
Created September 26, 2019 11:33
A configuration file of wrouesnel/postgres_exporter for collecting each table size
pg_class:
query: "SELECT n.nspname as schema, c.relname as relname, (c.relpages * 8192) as relsize_bytes FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','') AND n.nspname <> 'pg_catalog' AND n.nspname <> 'information_schema' AND n.nspname !~ '^pg_toast' AND pg_catalog.pg_table_is_visible(c.oid);"
metrics:
- schema:
usage: "LABEL"
description: "Schema of this table"
- relname:
usage: "LABEL"
description: "Name of this table"
- relsize_bytes:
func TestS3Put(t *testing.T) {
cleanup, addr := prepareS3Container(t)
defer cleanup()
sess := session.Must(session.NewSession(&aws.Config{
Credentials: credentials.NewStaticCredentials("dummy", "dummy", ""),
S3ForcePathStyle: aws.Bool(true),
Region: aws.String(endpoints.ApNortheast1RegionID),
Endpoint: aws.String(addr),
}))
package s3
import (
"bytes"
"fmt"
"io"
"net/http"
"testing"
"github.com/aws/aws-sdk-go/aws"
package s3
import (
"bytes"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
@munisystem
munisystem / BigQueryMemo.md
Last active June 22, 2022 12:53
BigQuery memo

間違っていることも多いので鵜呑みにしない。

用語

  • Project BigQueryのトップコンテナ、PostgreSQLで言うそれ本体みたいな意味合い
  • Dataset Tableの集合体、PostgreSQLで言うデータベース的な意味合い
  • Table そのまんま、PostgreSQLで言うテーブル的な意味合い
    • TableはTimestampみたいなsuffixをつけておくと、BQ側がまとめて見やすい形にしてくれる
  • Job Queryの実行やデータの追加はJobを通して行われる、トランザクションの実行単位

料金体系

package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/route53"
)
@munisystem
munisystem / multfact.pl
Created January 1, 2016 01:00
N!*(N-1)!*...*2!*1!
fact(N, 1) :- N < 1, !.
fact(N, X) :- N1 is N - 1,
fact(N1, Y),
X is N * Y.
multfact(N, 1) :- N < 1, !.
multfact(N, X) :- N1 is N - 1,
multfact(N1, Y),
fact(N, Z),
X is Z * Y.
@munisystem
munisystem / multfact.lsp
Created January 1, 2016 00:57
N!*(N-1)!*...*2!*1!
(defun factorial (num)
(cond ((= num 1) 1)
(t (* num (factorial (- num 1))))))
(defun multfact (num)
(cond ((= num 1) 1)
(t (* (factorial num) (multfact (- num 1))))))
@munisystem
munisystem / docker-default.rb
Last active December 7, 2015 06:56
itamae ghost settings for anti archlinux user
# itamae-archlinux/cookbook/docker/default.rb
package 'docker-io' do
notifies :start, 'service[docker]', :immediately
end
service 'docker' do
action :enable
end
@munisystem
munisystem / keymap.cson
Created August 7, 2015 07:08
atom editor keyconfig
'.editor':
'ctrl-n': 'native!'
'ctrl-p': 'native!'
'ctrl-n': 'core:move-down'
'ctrl-p': 'core:move-up'