Skip to content

Instantly share code, notes, and snippets.

Avatar

hitsumabushi hitsumabushi

  • Tokyo, Japan
View GitHub Profile
@hitsumabushi
hitsumabushi / log
Last active August 18, 2020 03:01
terraform aws_ecs_service tagging issue
View log
2020/08/18 11:50:51 [INFO] Terraform version: 0.12.29
2020/08/18 11:50:51 [INFO] Go runtime version: go1.12.13
2020/08/18 11:50:51 [INFO] CLI args: []string{"/home/hitsu/local/bin/terraform", "apply"}
2020/08/18 11:50:51 [DEBUG] Attempting to open CLI config file: /home/hitsu/.terraformrc
2020/08/18 11:50:51 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/08/18 11:50:51 [INFO] CLI command args: []string{"apply"}
2020/08/18 11:50:51 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/08/18 11:50:51 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/08/18 11:50:51 [DEBUG] New state was assigned lineage "c3be82e5-67bb-dc72-3b6c-4c8a76ba30a6"
2020/08/18 11:50:51 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
@hitsumabushi
hitsumabushi / README.md
Created June 8, 2018 09:52
One example: PostgreSQL doesn't use index with search condition on not balanced column
View README.md

How to solve this problem

  • change random_page_cost

How to run

Setup

  1. run postgres
docker run --rm -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=pass -d postgres:latest
@hitsumabushi
hitsumabushi / main.go
Created February 5, 2018 11:53
Google Pub/Sub Subscriber sample in Golang
View main.go
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"golang.org/x/oauth2/google"
@hitsumabushi
hitsumabushi / main.go
Created February 5, 2018 11:50
Google Pub/Sub Publisher sample in Golang
View main.go
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"google.golang.org/api/option"
@hitsumabushi
hitsumabushi / sacloud_inventory.py
Created December 5, 2017 13:18
sacloud inventory (for AWX container)
View sacloud_inventory.py
#!/usr/bin/env python
import sys
import argparse
import json
import os
import subprocess
# for exclude hosts, check tags
@hitsumabushi
hitsumabushi / peco-usacloud-ssh.sh
Last active July 10, 2017 07:59
peco + usacloud for ssh
View peco-usacloud-ssh.sh
##
# select ssh host from usacloud server list
#
function peco-select-usacloud-ssh-host(){
local res
# IPでアクセス
res=$(echo $row | cut -d'|' -f 6 | sed -e 's/ *\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\)\/.*/\1/')
# hostname が名前解決できる場合
# row=$(usacloud server list | grep -v "^\+--" | peco)
res=$(echo $row | awk '{print $4;}')
@hitsumabushi
hitsumabushi / petstore_simple_2.0.yml
Last active May 20, 2017 08:49
Open API Specification 2.0 and 3.0.0-rc1
View petstore_simple_2.0.yml
swagger: '2.0'
info:
version: '1.0.0'
title: Swagger Petstore (Simple)
description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification
termsOfService: http://helloreverb.com/terms/
contact:
name: Swagger API team
email: foo@example.com
url: http://swagger.io
View openapi.json
{
"openapi": "3.0.0-RC1",
"servers": [
{
"url": "https://api.sakura.io/"
}
],
"info": {
"version": "1.0.3",
"title": "sakura.io API",
View 草の集計.md

草のところのsvg を github というファイルに保存して、 github.csv というファイルにする。 GHE側でも同様に、ghe.csv を作る

$ grep "data-date" github | cut -d ' ' -f 18,19 | cut -d'>' -f1 | sed -e 's/data-count="\([^"]*\)" data-date="\([^"]*\)"/\2,\1/' > github.csv