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
  • BiggestFan Production
  • Thailand
View GitHub Profile
@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 / settrace.py
Created March 11, 2021 12:46
python settrace
import pdb; pdb.set_trace()
@SuperCipher
SuperCipher / pullrequest_comment_template.md
Last active March 19, 2021 10:26
pullrequest comment template
@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 / filterArrayWithArray.elm
Created March 24, 2021 11:38
filter array with array in elm / functional language
filterProduct : Product.ProductModelList -> Product.ProductModelList
filterProduct productModelList =
List.filter (\x -> List.member x.id ["products-id-uu01","products-id-uu02"]) productModelList
@SuperCipher
SuperCipher / fetch.js
Created March 30, 2021 12:07
fetch real life example
function requestBid(eventID,requestSlpAddress) {
const url = AUCTION_BACKEND_URL;
const data = {
eventID: eventID,
bidderAddress: requestSlpAddress
};
const jsonData = JSON.stringify(data);
const params = {
@SuperCipher
SuperCipher / self-execute.js
Created May 31, 2021 08:15
self execute JS
(async () => {
try {
// console.log('resp', resp)
} catch (e) {
console.error(e);
}
})();
@SuperCipher
SuperCipher / ElmTimeTicket.elm
Created June 2, 2021 09:47
Elm Time Ticket
import Time
subscriptions : ModelsElmArchitect.State -> Sub Msg
subscriptions _ =
Time.every (5 * 1000) (\_ -> ModelsElmArchitect.Reload)
@SuperCipher
SuperCipher / nix-resource.txt
Last active June 18, 2021 13:30
nix resource
Nix language Fundamentals
https://www.youtube.com/watch?v=m4sv2M9jRLg