Skip to content

Instantly share code, notes, and snippets.

@tom-code
tom-code / csr.go
Last active April 20, 2019 14:37
generate stir/shaken csr ATIS-1000080
package main
import (
"encoding/asn1"
"crypto/elliptic"
"crypto/ecdsa"
"crypto/rand"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
@tom-code
tom-code / Mac config
Last active January 19, 2020 21:01
Mac config
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
defaults write com.microsoft.VSCode.helper CGFontRenderingFontSmoothingDisabled 0
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
defaults write ~/Library/Preferences/.GlobalPreferences com.apple.swipescrolldirection -bool false
defaults write bluetoothaudiod "Enable AptX codec" -bool true
defaults write bluetoothaudiod "Enable AAC codec" -bool true
defaults write com.apple.Preview PVPDFAntiAliasOption 0
@tom-code
tom-code / gist:53b9256e058797ac8685786d8102f5d0
Created February 4, 2019 11:59
kuber image as ssh server
Dockerfile:
FROM alpine
RUN apk --update add --no-cache openssh bash \
&& sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config \
&& echo "root:root" | chpasswd \
&& rm -rf /var/cache/apk/*
RUN sed -ie 's/#Port 22/Port 22/g' /etc/ssh/sshd_config
RUN sed -ri 's/#HostKey \/etc\/ssh\/ssh_host_key/HostKey \/etc\/ssh\/ssh_host_key/g' /etc/ssh/sshd_config
RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_rsa_key/HostKey \/etc\/ssh\/ssh_host_rsa_key/g' /etc/ssh/sshd_config
@tom-code
tom-code / main.go
Created January 18, 2019 16:46
goku2
package main
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
@tom-code
tom-code / configmap.yaml
Last active January 18, 2019 16:33
kubernetes configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: config1
labels:
app: vla
data:
config1.json: ' {
"aaa": "ccc"
@tom-code
tom-code / h2c.go
Last active July 3, 2025 10:28
golang h2c http2 client and server
package main
import (
"fmt"
"net/http"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
"crypto/tls"
"net"
)
@tom-code
tom-code / acme2.go
Last active December 26, 2018 16:36
acme client v2 with http auth
package main
import (
"fmt"
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
@tom-code
tom-code / acme.go
Created December 22, 2018 00:21
acme experiment
package main
import (
"fmt"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"os"
@tom-code
tom-code / jws.go
Created December 21, 2018 15:25
jws sign and verify example
package main
import(
"fmt"
"gopkg.in/square/go-jose.v2"
"encoding/json"
"io/ioutil"
"crypto/ecdsa"
)
@tom-code
tom-code / convert.go
Last active December 21, 2018 14:36
convert jwk to pem (EC only)
package main
import(
"fmt"
"gopkg.in/square/go-jose.v2"
"encoding/json"
"io/ioutil"
"crypto/ecdsa"
"crypto/x509"
"encoding/pem"