NOTE: This guide is ONLY for devs who don't want to edit their
yarn.lock
file by hand. If you don't care about that please carry on.
So you've pulled the latest master
git checkout master
git pull
# WSL2 network port forwarding script v1 | |
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell, | |
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter. | |
# written by Daehyuk Ahn, Aug-1-2020 | |
# Display all portproxy information | |
If ($Args[0] -eq "list") { | |
netsh interface portproxy show v4tov4; | |
exit; | |
} |
use std::str; | |
fn main() { | |
// -- FROM: vec of chars -- | |
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}']; | |
// to String | |
let string1: String = src1.iter().collect::<String>(); | |
// to str | |
let str1: &str = &src1.iter().collect::<String>(); | |
// to vec of byte |
# Generate a unique private key (KEY) | |
sudo openssl genrsa -out mydomain.key 2048 | |
# Generating a Certificate Signing Request (CSR) | |
sudo openssl req -new -key mydomain.key -out mydomain.csr | |
# Creating a Self-Signed Certificate (CRT) | |
openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt | |
# Append KEY and CRT to mydomain.pem |
NOTE: This guide is ONLY for devs who don't want to edit their
yarn.lock
file by hand. If you don't care about that please carry on.
So you've pulled the latest master
git checkout master
git pull
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
function asyncWhile(condition, action, ctx) { | |
var whilst = function(data) { | |
return condition.call(ctx, data) ? | |
Promise.resolve(action.call(ctx, data)).then(whilst) : | |
data; | |
} | |
return whilst(); | |
} |
module.exports = { | |
'HOSTPATH': 'http://your.host.here', | |
'PORT': 80, | |
'EXPRESS_SESSION_SECRET': '123456', | |
'TWITTER_CONSUMER_KEY': 'your-consumer-key-here', | |
'TWITTER_CONSUMER_SECRET': 'your-secret-here', | |
'GOOGLE_APP_ID': 'your-app-id-here', | |
'GOOGLE_CONSUMER_SECRET': 'your-consumer-secret-here', | |
}; |
// Encrypt where jo is input, and query is output and ENCRPYTION_KEy is key | |
byte[] input = jo.toString().getBytes("utf-8"); | |
MessageDigest md = MessageDigest.getInstance("MD5"); | |
byte[] thedigest = md.digest(ENCRYPTION_KEY.getBytes("UTF-8")); | |
SecretKeySpec skc = new SecretKeySpec(thedigest, "AES/ECB/PKCS5Padding"); | |
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); | |
cipher.init(Cipher.ENCRYPT_MODE, skc); | |
byte[] cipherText = new byte[cipher.getOutputSize(input.length)]; |