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 makeFormData (params) { | |
return Object.keys(params).map((key) => { | |
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) | |
}).join('&') | |
} |
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
xattr -r -d com.apple.quarantine ./ |
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
const fetch = require('node-fetch') | |
function addUrlQueryParams (endpoint, params) { | |
let url = new URL(endpoint) | |
if (params) { | |
// append URL query paramenters | |
Object.keys(params).forEach(key => { | |
url.searchParams.append(key, params[key]) | |
}) | |
} |
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 hashString (s) { | |
if (s.length === 0) { | |
return 0 | |
} | |
let hash = 0 | |
for (let i = 0; i < s.length; i++) { | |
const char = s.charCodeAt(i) | |
hash = (( hash << 5 ) - hash) + char | |
// Convert to 32-bit integer | |
hash = hash & hash |
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
// remove non-ascii characters | |
var str = "©1981" | |
str.replace(/[^\x00-\x7F]/g, "") |
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
ffmpeg -i input.wav -c:a pcm_mulaw -ar 8000 -ac 1 -ab 16 output.wav |
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
openssl s_client -showcerts -servername ad1.dcloud.cisco.com -connect ad1.dcloud.cisco.com:636 2>/dev/null |
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
sudo update-alternatives --config editor |
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
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt update | |
sudo apt install yarn |
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 expires () { | |
return (this.adUser.accountExpires - 116444736000000000) / 10000 | |
} |