Skip to content

Instantly share code, notes, and snippets.


Ali Najafizadeh alinz

View GitHub Profile
View gist:1d67908ccff03ca2d80b86260cb82aef
type Claims struct {
AccountID string `json:"account_id"`
GroupID string `json:"group_id"`
// Encode
func (c *Claims) Encode(secretKey []byte) (string, error) {
const op = errors.Op("jwt.Claims.Encode")
View gist:92fd7b56d400b59bc584935ae0ce15b6
package config
import (
type Config struct {
alinz / Certificates.go
Created Nov 12, 2019 — forked from Mattemagikern/Certificates.go
Create x509 certificate chain using Golang. Root CA, Designated CA, server CA
View Certificates.go
package main
import (
alinz /
Created Nov 12, 2019
OPENSSL encrypt decrypt
openssl aes-256-cbc -in plain.txt -out plain.enc -k cool
openssl aes-256-cbc -d -in plain.enc -out plain.txt -k cool
alinz / PROFILE.MD
Created Nov 7, 2019
Golang Profiling commands


Generate Prfile data

go test -cpuprofile -memprofile -bench .

Visual Profile data

View model.ts
export class Model {
constructor(obj: any) {
for (let key in obj) {
this.unmarshal(toCamelCase(key), obj[key])
marshal(): any {
return Object.keys(this).reduce((obj: any, key: string) => {
obj[toSnakeCase(key)] = toJS(this[key])
alinz / Makefile
Created Sep 25, 2019
Compile Zig to WebAssembly and run it in Node.js
View Makefile
zig build-exe --name test.wasm -target wasm32-freestanding --release-small test.zig
View setup react project
// babel js
"plugins": [
"import", {
"libraryName": "antd",
"libraryDirectory": "es",
alinz / golang_tls_http.go
Created Jul 11, 2019
Share tls config with server and client in golang
View golang_tls_http.go
package main
import (
alinz / router.go
Created Jul 7, 2019
router with cors
View router.go
import (
func New() chi.Router {
cors := cors.New(cors.Options{
You can’t perform that action at this time.