require('crypto').randomBytes(64).toString('hex');
// 918fc5da09945d2f4086d2458f514bd4cacf6cab559174420f1e7d2caa8881edfdd78c417b9ad32b3c67a19ef4267bc50ff08cb913df158757b375c7f97371b6
require('crypto').randomBytes(64).toString('base64');
// hJNB4j5SI+mVxrvhoD/cSdHBMSFqWImEKlfWtMRVRSzoHp2uTSbixhBQ6iLaWtFK2mTENOUM6/mD2pD1ufgsAA==
require('crypto').randomBytes(64).toString('base64url');
// aMVKjWq3O0orHGddbW1HYQjD8hFeEtuH0Jrx80ZD0obT_wX8V9atgddDFMI3GS5InYbCoQAPVsMuzxGOJ_zi0g
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Handle image uploaded with multipart/form-data POST Request. | |
Save image to temp files, | |
image then removed after some process, | |
then return / serve the (processed) image as response. | |
Using gorilla mux router. | |
*/ | |
package main | |
import ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
- how to use this file: https://docs.chocolatey.org/en-us/choco/commands/install#packages.config | |
- how to generate this file: | |
- from chocolatey packages repository with script builder: https://docs.chocolatey.org/en-us/community-repository/script-builder | |
- from other windows machine with export command: https://docs.chocolatey.org/en-us/choco/commands/export | |
--> | |
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<package id="googlechrome" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// nodejs crypto (server side) | |
// Math.random() replacement | |
const cryptoRandom = () => parseInt(require("crypto").randomBytes(4).toString("hex"), 16) / (0xffffffff + 1) | |
// generate random number integer based on minimum and maximum | |
const cryptoRandomNumber = (min, max) => require("crypto").randomInt(min, max + 1) | |
// generate random string (hex/base64) based on bytes | |
const cryptoRandomString = (bytes, encoding = "hex") => require("crypto").randomBytes(bytes).toString(encoding) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
# modified from https://stackoverflow.com/a/15678731/12479141 | |
# add small capabilities to disallowed extension | |
# The current directory | |
$directory = dir("./"); | |
# If you want to turn on Extension Filter, then uncomment this: | |
### $allowed_ext = array(".sample", ".png", ".jpg", ".jpeg", ".txt", ".doc", ".xls", ".notshow"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# USAGE: | |
# command example.com [OPTIONS] | |
# | |
# args desc | |
# example.com the domain name | |
# | |
# options args desc | |
# --app-name short-app-name required if --pm2-start is yes |