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
@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
}
#!/bin/bash
PGPASSWORD="password" psql -h127.0.0.1 -p5432 -Uuser -ddatabase
@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 -
@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 {
package bloom
import (
"encoding/gob"
"bytes"
)
func GetBytes(key interface{}) ([]byte, error) {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
function! s:find_git_root()
return system('git rev-parse --show-toplevel 2> /dev/null')[:-2]
endfunction
command! ProjectFiles execute 'Files' s:find_git_root()
class Sample:
def __init__(self):
pass
@classmethod
def helloo(cls):
print('class hello')
def hello(self):
try:
print("try")
raise Exception("RAISE")
except Exception as e:
print(e)
finally:
print("finally")
%load_ext autoreload
%autoreload 2
1. 15
2. 30
3. 60
4. 125
5. 250
6. 500
7. 1000
1. 0
2. 0