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
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/ | |
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch | |
// async function | |
async function fetchAsync () { | |
// await response of fetch call | |
let response = await fetch('https://api.github.com'); | |
// only proceed once promise is resolved | |
let data = await response.json(); | |
// only proceed once second promise is resolved |
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
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key | |
# Don't add passphrase | |
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub | |
cat jwtRS256.key | |
cat jwtRS256.key.pub |
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
var CryptoJS = require("crypto-js");//replace thie with script tag in browser env | |
//encrypt | |
var rawStr = "hello world!"; | |
var wordArray = CryptoJS.enc.Utf8.parse(rawStr); | |
var base64 = CryptoJS.enc.Base64.stringify(wordArray); | |
console.log('encrypted:', base64); | |
//decrypt | |
var parsedWordArray = CryptoJS.enc.Base64.parse(base64); |
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
function php_lint | |
{ | |
for arg in $(seq $#) | |
do | |
# Use find to iterate over directories recursively | |
if [ -d "${!arg}" ]; then | |
find "${!arg}" -name '*.php' -exec php -l "{}" ";" | |
# Just run normal files and symlinks through php -l individually | |
elif [ -f "${!arg}" -o -h "${!arg}" ]; then | |
php -l "${!arg}" |
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
alias mysqldbs='_() { local h=""; if [ ! -z "$2" ]; then h="-h$2"; fi; echo "show databases;" | mysql -u "$1" "$h" -p; }; _' |
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
#-------------------------------------------------------- | |
# Simple search and replace utility for git repositories. | |
# @note Use w/ GNU sed. | |
# (c) Nathan Nobbe 2014 | |
# [email protected] | |
# http://quickshiftin.com | |
# $1 - Search | |
# $2 - Replace | |
# $3 - Subdirectory (optional, defaults to cwd) | |
#-------------------------------------------------------- |
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
alias lastd='echo ~/Downloads/$(ls -t ~/Downloads/ | head -n 1)' |
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
#!/usr/bin/env bash | |
# author: Thomas Aylott SubtleGradient.com | |
# author: Nathan Nobbe quickshiftin.com | |
# Find out where HEAD is pointing | |
head_ref=$(git show-ref --head -s | head -n 1) | |
# Check to see if transmit tag exists, and get transmit tag hash | |
_transmit_ref=$(git show-ref --verify -s refs/tags/transmit) | |
# If there's not transmit tag, create it for the first time. |
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
var data = "do shash'owania"; | |
var crypto = require('crypto'); | |
crypto.createHash('md5').update(data).digest("hex"); |