Skip to content

Instantly share code, notes, and snippets.

View int128's full-sized avatar

Hidetake Iwata int128

View GitHub Profile
@int128
int128 / main.go
Created March 23, 2018 01:06
Shutdown HTTP server by requesting specific URL in Golang
package main
import (
"context"
"fmt"
"log"
"net/http"
)
func main() {
@int128
int128 / main.go
Created March 20, 2018 07:45
Read and write Kubernetes client config (~/.kube/config) in Go
package main
import (
"log"
"os"
"github.com/mitchellh/go-homedir"
"k8s.io/client-go/tools/clientcmd"
)
@int128
int128 / main.go
Created March 19, 2018 07:43
OpenID Connect auth code flow with Go
package main
import (
"crypto/rand"
"encoding/binary"
"fmt"
"github.com/coreos/go-oidc"
"golang.org/x/oauth2"
)
@int128
int128 / kubernetes-dashboard-proxy.yaml
Last active February 24, 2021 00:58
Access Kubernetes Dashboard via OpenID Connect Proxy
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kubernetes-dashboard-proxy
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
@int128
int128 / switch_symlink.sh
Created January 31, 2018 06:11
Shell script to switch symbolic link
@int128
int128 / RequestAndResponseLoggingFilter.java
Last active January 13, 2024 10:46
Spring Web filter for logging request and response
/*
Copyright 2017 Hidetake Iwata
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@int128
int128 / README.md
Last active August 18, 2017 09:47
Testing GitHub compatible URL access on GitBucket

Prerequisite

  • Install and configure GitBucket at http://localhost:8080
  • Deny anonymous access
  • Create a group hello
  • Create a repository hello/foo with README.md

Test cases

@int128
int128 / example.ldif
Created August 18, 2017 05:51
Example LDAP data generated by Crowd (JIRA)
dn:
objectClass: glue
structuralObjectClass: glue
entryUUID: ********
creatorsName: cn=admin,dc=example,dc=org
createTimestamp: 20170817063913Z
entryCSN: 20170817063913.365569Z#000000#000#000000
modifyTimestamp: 20170817063913Z
memberOf: cn=crowd-administrators,dc=example,dc=org
modifiersName: cn=admin,dc=example,dc=org
@int128
int128 / gist:f7004b9e695b8975487d7ea1619a3e4a
Last active August 16, 2017 04:00
Cost Estimation of Local NUC and Cloud Instance

High performance NUC

Core i5 2C4T 2.2GHz, 32GB RAM, 512GB SSD

  • NUC7i5BNH \47,000
  • SODIMM DDR4 PC4-17000 16GB x2 \30,000
  • M2.SSD 512GB \24,000

Total \101,000

@int128
int128 / gist:181c075ce966022ae1d129e450dd3051
Last active October 14, 2017 08:22
Example of Doc2Vec and Google Cloud Natural Language API
from gensim.models.doc2vec import Doc2Vec
from gensim.models.doc2vec import TaggedDocument
from google.cloud import language
def wakachigaki(text):
client = language.Client()
document = client.document_from_text(text)
annotations = document.annotate_text()
words = []