Skip to content

Instantly share code, notes, and snippets.

View diazoxide's full-sized avatar
🖱️
Finding solutions!

Aaron Yordanyan diazoxide

🖱️
Finding solutions!
View GitHub Profile
@diazoxide
diazoxide / custom_crypto_algorithm.js
Created March 23, 2023 12:04
Custom strong cryptography algorithm on JS
function xorWithKey(input, key) {
let output = "";
for (let i = 0; i < input.length; i++) {
let keyChar = String(key[i % key.length]);
output += String.fromCharCode(input.charCodeAt(i) ^ keyChar.charCodeAt(0));
}
return output;
}
function customSubstitution(input, substitutionTable) {
@diazoxide
diazoxide / strong-password.ts
Created March 22, 2023 07:30
TypeScript generate strong password
function generateRandomSecret(length = 32): string {
const haystacks = [
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"0123456789",
"~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/"
];
const randomPart = (haystack: string, length: number)=>{
let retVal = "";
for (let i = 0, n = haystack.length; i < length; ++i) {
@ragul28
ragul28 / daemonset-scaledown.md
Created January 11, 2020 09:20
k8s Trick to Scale down daemonset to zero
  • Scaling k8s daemonset down to zero
kubectl -n kube-system patch daemonset myDaemonset -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
  • Scaling up k8s daemonset
kubectl -n kube-system patch daemonset myDaemonset --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
@julienroubieu
julienroubieu / npm-install-all.sh
Created November 1, 2017 16:32
Run npm install in all subdirectories
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && npm install" \;