Skip to content

Instantly share code, notes, and snippets.

View h2xd's full-sized avatar

Andrej Schujkow h2xd

View GitHub Profile
@h2xd
h2xd / randomPassword.js
Last active July 27, 2020 09:57
Generate a random password in JavaScript; based on your char selection
const getRandomCharsFromString = (charset, length) =>
charset.split('')
.sort(() => Math.random() - 0.5)
.slice(0, length)
.join('')
export const generateRandomPassword = () => (
[
getRandomCharsFromString('0123456789', 4),
getRandomCharsFromString('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 6),
@h2xd
h2xd / .bashrc
Created May 13, 2020 20:10
Windows .bashrc to autostart the ssh agent and add your ssh-keys automatically
if [[ "$SSH_AUTH_SOCK" = "" ]]; then
# first round add the ssh agent
exec ssh-agent bash
else
# here you can add your ssh keys
# github as an example
ssh-add ~/.ssh/github_com_rsa
fi
@h2xd
h2xd / font-loader.scss
Last active August 17, 2018 16:01
SCSS mixin for font loading, logical directory scheme required
/**
* Load font-faces with no pain, that follow a named directory pattern
* GoogleFonts does so
* ---
* @params {String} $name - the name of the font
* @params {String} $path - font directory path
* @params {Map<String>} $types - the font-types you want to load ("Thin", "ThinItalic", "Light", "LightItalic", "Regular", "Italic", "Medium", "MediumItalic", "Bold", "BoldItalic", "ExtraBold", "ExtraBoldItalic", "Black", "BlackItalic")
* @returns {void}
* ---
* @licence MIT