Skip to content

Instantly share code, notes, and snippets.

View SuperCipher's full-sized avatar
💭
GMT+7 08:00 - 22:00

Napat SuperCipher

💭
GMT+7 08:00 - 22:00
  • Thailand
View GitHub Profile
@SuperCipher
SuperCipher / elmDataGen.elm
Created March 16, 2021 12:17
elm list data gen
-- [[13,41,3,94,59], [59,79,70], [ 15,41,81], [11]]
-- [[94,59,41,13,3],[79,70,59],[81,41,15],[11]]
sampleData : List (List Float)
sampleData =
-- [[13,41,3,94,59], [59,79,70,0,0], [15,41,81,0,0], [11,0,0,0,0]]
padAll [[13,41,3,94,59], [59,79,70], [ 15,41,81], [11]]
zeroPad : Int -> List Float -> List Float
zeroPad target ns =
let
@SuperCipher
SuperCipher / pullrequest_comment_template.md
Last active March 19, 2021 10:26
pullrequest comment template
@SuperCipher
SuperCipher / settrace.py
Created March 11, 2021 12:46
python settrace
import pdb; pdb.set_trace()
@SuperCipher
SuperCipher / JWT-Ed25519.py
Last active March 11, 2021 12:18
JWT Ed25519 encode decode example (EdDSA)
import jwt
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption, PublicFormat
from nacl.public import PrivateKey
from cryptography.hazmat.backends import default_backend
key = PrivateKey.generate()
cryptography_key = Ed25519PrivateKey.from_private_bytes(bytes(key))
private_key_byte = cryptography_key.private_bytes(
@SuperCipher
SuperCipher / coincurve.py
Last active January 14, 2021 11:22
coincurve13.0.0 generate hash message from private key
coincurve 13.0.0 pypi_0 pypi
Python 3.7.4 (default, Aug 13 2019, 15:17:50)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.hazmat.backends import default_backend
>>> from cryptography.hazmat.primitives.asymmetric import rsa
>>> private_key = rsa.generate_private_key(
... public_exponent=65537,
... key_size=2048,
@SuperCipher
SuperCipher / TH-covid19-curve_fit.py
Created January 6, 2021 16:57
Test Thailand coronavirus graph fitting
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
# %matplotlib inline
x = [46,67,81,110,121,144,155,250,194,279,216,315,745,527]
j = 0
buckets = [0] * len(x)
m = 0
@SuperCipher
SuperCipher / commit-convention.md
Last active March 11, 2021 11:55
commit convention type and sample

Angular type

Must be one of the following:

build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
docs: Documentation only changes
feat: A new feature
fix: A bug fix

perf: A code change that improves performance

@SuperCipher
SuperCipher / nix-shell-ghci.sh
Last active December 4, 2020 17:48
try haskell with nix-shell ghci
#!/bin/bash
# try haskell easily with nix shell
# credit @freenode_srk:matrix.org
nix-shell -p "pkgs.haskell.packages.ghc883.ghcWithPackages (p: [ ])"