Skip to content

Instantly share code, notes, and snippets.

View alinz's full-sized avatar
🎯
¯\_(ツ)_/¯

Ali Najafizadeh alinz

🎯
¯\_(ツ)_/¯
View GitHub Profile
@alinz
alinz / react-native-notifications+3.3.4.patch
Last active December 17, 2020 17:53
A react-native-notifications patch for getting scheduled local notification working in Android
diff --git a/node_modules/react-native-notifications/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java b/node_modules/react-native-notifications/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java
index f9c858b..94ea188 100644
--- a/node_modules/react-native-notifications/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java
+++ b/node_modules/react-native-notifications/android/app/src/reactNative59/java/com/wix/reactnativenotifications/NotificationManagerCompatFacade.java
@@ -2,8 +2,8 @@
package com.wix.reactnativenotifications;
import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.v4.app.NotificationManagerCompat;
type Claims struct {
AccountID string `json:"account_id"`
GroupID string `json:"group_id"`
jwtgo.StandardClaims
}
// Encode
func (c *Claims) Encode(secretKey []byte) (string, error) {
const op = errors.Op("jwt.Claims.Encode")
package config
import (
"os"
"strings"
"github.com/spf13/viper"
)
type Config struct {
@alinz
alinz / Certificates.go
Created November 12, 2019 05:29 — forked from Mattemagikern/Certificates.go
Create x509 certificate chain using Golang. Root CA, Designated CA, server CA
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"math/big"
@alinz
alinz / sample.sh
Created November 12, 2019 00:13
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
alinz / PROFILE.MD
Created November 7, 2019 17:24
Golang Profiling commands

Prfile

Generate Prfile data

go test -cpuprofile cpu.prof -memprofile mem.prof -bench .

Visual Profile data

@alinz
alinz / model.ts
Created October 13, 2019 12:41
Model
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
alinz / Makefile
Created September 25, 2019 19:26
Compile Zig to WebAssembly and run it in Node.js
build:
zig build-exe --name test.wasm -target wasm32-freestanding --release-small test.zig
// babel js
{
"plugins": [
["react-hot-loader/babel"],
["babel-plugin-root-import"],
[
"import", {
"libraryName": "antd",
"libraryDirectory": "es",
@alinz
alinz / golang_tls_http.go
Created July 11, 2019 19:59
Share tls config with server and client in golang
package main
import (
"bytes"
"crypto/tls"
"crypto/x509"
"io"
"io/ioutil"
"log"
"net/http"