Skip to content

Instantly share code, notes, and snippets.

View leonj1's full-sized avatar
💭
Coding on the brain

Jose M Leon leonj1

💭
Coding on the brain
View GitHub Profile

Keybase proof

I hereby claim:

  • I am leonj1 on github.
  • I am joseleon (https://keybase.io/joseleon) on keybase.
  • I have a public key whose fingerprint is 33E3 A8BE 7534 B868 E46C 706E 6027 9E22 E937 1A6B

To claim this, I am signing this object:

@leonj1
leonj1 / stress.sh
Created May 3, 2017 11:16
Stress test your Go packages
Source: https://dave.cheney.net/2013/06/19/stress-test-your-go-packages
Stress test your Go packages
This is a short post on stress testing your Go packages.
Concurrency or memory correctness errors are more likely to show up
at higher concurrency levels (higher values of GOMAXPROCS).
I use this script when testing my packages, or when reviewing code that goes into the standard library.
#!/usr/bin/env bash -e
20:46:56.597867 Dispatch 2: LOOKUP, NodeId: 1. names: [tmp] 4 bytes
** Lookup **
** Lookup: header: &{44 1 2 1 {{0 0} 17904} 0} Name: tmp **
** internalLookup out: {M00 SZ=0 L=0 0:0 B0*0 i0:0 A 0.000000000 M 0.000000000 C 0.000000000} parent: &{{0 2 1} 0 {0 0} [] 0xc420095140 0xc4200b46e0 map[] map[] 0xc4200b46e0} name: tmp header: &{44 1 2 1 {{0 0} 17904} 0}**
------------------------
In pathfs.Lookup
GetAttr
Fileystem info for tmp: {0 0 10970 16386 supergroup 0 1501706646380 hdfs 1777 0 0 DIRECTORY}
GetAttr FileStatus: {0 0 10970 16386 supergroup 0 1501706646380 hdfs 1777 0 0 DIRECTORY}
GetAttr: Directory found
20:47:03.949496 Dispatch 12: LOOKUP, NodeId: 1. names: [tmp] 4 bytes
** Lookup **
** Lookup: header: &{44 1 12 1 {{0 0} 17984} 0} Name: tmp **
** internalLookup out: {M00 SZ=0 L=0 0:0 B0*0 i0:0 A 0.000000000 M 0.000000000 C 0.000000000} parent: &{{0 2 1} 0 {0 0} [] 0xc420095140 0xc4200b46e0 map[tmp:0xc42007a8c0] map[] 0xc4200b46e0} name: tmp header: &{44 1 12 1 {{0 0} 17984} 0}**
------------------------
In pathfs.GetAttr
Out: {M00 SZ=0 L=0 0:0 B0*0 i0:0 A 0.000000000 M 0.000000000 C 0.000000000}
File: <nil>
Context: &{{0 0} 17984}
------------------------
.............................
IN server.handleRequest Beginning. Request Header: &{44 1 2 1 {{0 0} 34439} 0}
goroutine 1 [running]:
runtime/debug.Stack(0x39, 0xc42006dc30, 0x1)
/usr/local/go/src/runtime/debug/stack.go:24 +0x79
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x22
ds-webhdfs/vendor/github.com/hanwen/go-fuse/fuse.(*Server).handleRequest(0xc4200b6540, 0xc4200d4900, 0xc4200d4900)
/home/jleon43/go/src/ds-webhdfs/vendor/github.com/hanwen/go-fuse/fuse/server.go:387 +0x17c
ds-webhdfs/vendor/github.com/hanwen/go-fuse/fuse.(*Server).loop(0xc4200b6540, 0x0)
.............................
IN server.handleRequest Beginning. Request Header: &{44 1 12 1 {{0 0} 34627} 0}
goroutine 5 [running]:
runtime/debug.Stack(0x39, 0xc420069e70, 0x1)
/usr/local/go/src/runtime/debug/stack.go:24 +0x79
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x22
ds-webhdfs/vendor/github.com/hanwen/go-fuse/fuse.(*Server).handleRequest(0xc4200b6540, 0xc420122000, 0xc420122000)
/home/jleon43/go/src/ds-webhdfs/vendor/github.com/hanwen/go-fuse/fuse/server.go:387 +0x17c
ds-webhdfs/vendor/github.com/hanwen/go-fuse/fuse.(*Server).loop(0xc4200b6540, 0x64ab01)
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println("Starting")
argsWithProg := os.Args
@leonj1
leonj1 / steps.txt
Created August 19, 2017 01:45
How I create a Certificate for REST endpoints and import into Java Keystore
# Create cert and store
openssl genrsa -out server.key 2048
openssl rsa -in server.key -out server.key
openssl req -sha256 -new -key server.key -out server.csr -subj '/CN=localhost'
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out localhost.crt
# convert to pkcs12, and then convert to Java keystore
openssl pkcs12 -export -in localhost.crt -inkey server.key -out server.p12 -name localhost -CAfile ca.crt -caname root
keytool -importkeystore -deststorepass changeit -destkeypass changeit -destkeystore keystore.jks -srckeystore server.p12 -srcstoretype PKCS12 -srcstorepass changeit -alias localhost
@leonj1
leonj1 / install_go_in_raspi.txt
Last active August 20, 2017 14:15
How to install Go and ffmpeg in Raspberry Pi
mkdir -p /tmp/go
cd /tmp/go
wget https://storage.googleapis.com/golang/go1.8.3.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.8.3.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile
. ~/.profile
mkdir -p ~/go/src
mkdir -p ~/go/bin

Flexvolume notes

  • Steps takes to attempt to get FlexVolume working in Kubernetes 1.6.6, 1.7.1, and 1.7.4
  • Test performed in Vagrant with 1 node (w1)

Environment

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:34:20Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:21:54Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}