Skip to content

Instantly share code, notes, and snippets.

View locona's full-sized avatar
:octocat:
On vacation

Miyamae Yuuya locona

:octocat:
On vacation
View GitHub Profile
package bloom
import (
"encoding/gob"
"bytes"
)
func GetBytes(key interface{}) ([]byte, error) {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
@locona
locona / yaml-multiple-document-parse.go
Created July 11, 2018 23:21
[golang] yaml multiple document parse
package main
import (
"os"
"github.com/k0kubun/pp"
yaml "gopkg.in/yaml.v2"
)
type DNS struct {
@locona
locona / kubectl-copy.sh
Created July 9, 2018 03:46
kubectl copy to different namespace
kubectl get secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create -f -
#!/bin/bash
PGPASSWORD="password" psql -h127.0.0.1 -p5432 -Uuser -ddatabase
@locona
locona / all_file_under_dir.go
Created June 28, 2018 02:24
Golang get all files under the directory
package main
func main() {
searchDir := "./day=27"
fileList := make([]string, 0)
filepath.Walk(searchDir, func(path string, f os.FileInfo, err error) error {
if f.IsDir() {
return nil
}
@locona
locona / dir.go
Created June 27, 2018 08:04
dir/* path list
dir := "./hour=05"
files, err := ioutil.ReadDir(dir)
if err != nil {
panic(err)
}
var paths []string
for idx := range files {
paths = append(paths, filepath.Join(dir, files[idx].Name()))
}
<Card style={{ marginLeft: '64px' }}>
<PageHeader
position="static"
color="default"
>
<Toolbar style={{ width: '30%' }}>
<Typography variant="title" color="inherit" style={{ minWidth: '220px' }}>
</Typography>
<TrackingWebNew handleSubmit={handleSubmit} />
curl ipinfo.io/ip
package main
import (
"io/ioutil"
"github.com/k0kubun/pp"
yaml "gopkg.in/yaml.v2"
)
type Data struct {
package main
import (
"fmt"
"go/ast"
"reflect"
"regexp"
"strings"
"time"