Skip to content

Instantly share code, notes, and snippets.

View a666hn's full-sized avatar
🚀
Meroket

Adi Hermawan a666hn

🚀
Meroket
  • PT. Sinbad Karya Perdagangan
  • 127.0.0.1
  • X @skinnyguy_
View GitHub Profile
@a666hn
a666hn / jwt-key.sh
Last active May 11, 2024 03:31
How to use RSA256 algorithm JWT in python
# Generate Private Key
openssl genrsa -out jwt-key-name 4096
# Dont add passphrase
# ssh-keygen should generate private and public key
# Update public key using openssl
openssl rsa -in jwt-key -pubout > jwt-key-name.pub
# Formatting private key into single line
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' jwt-key-name
@a666hn
a666hn / getContrasText.js
Created April 27, 2021 08:02
Generate contrast text!!!
function setContrastText(hexColor="", isBlackAndWhite=false) {
if (!hexColor) return "black"
if (hexColor.slice(0, 1) === "#") {
hexColor = hexColor.slice(1)
}
if (hexColor.length === 3) {
hexColor = hexColor.repeat(2)
}
@a666hn
a666hn / downloadcsv.js
Created December 19, 2020 08:56
Generated data into csv with papaparse in javascript
function downloadCSV(csvTitle = "", csvHeader = [], csvData = []) {
// create filename using today unix time
const today = new Date().getTime()
const fileName = "Download-" + today + ".csv";
// Create title for csv
const title = csvTitle || "Download CSV example"
// Add header into first row
csvData.splice(0, 0, csvHeader)