Skip to content

Instantly share code, notes, and snippets.

View evanmoran's full-sized avatar

Evan Moran evanmoran

View GitHub Profile
static OSStatus
SSLVerifySignedServerKeyExchange(SSLContext *ctx, bool isRsa, SSLBuffer signedParams,
uint8_t *signature, UInt16 signatureLen)
{
OSStatus err;
...
if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
goto fail;
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
@evanmoran
evanmoran / node-download
Created October 14, 2013 16:32
Download file with Node
// download: download the url to string
utl.download = function(url, cb){
var options = require('url').parse(url),
httpx = url.startsWith(url, 'https:') ? https : http,
data = "",
req = httpx.request(options, function(res){
res.setEncoding("utf8")
res.on("data", function(chunk){
return data += chunk;
})
@evanmoran
evanmoran / fast-gh-pages
Last active December 12, 2015 08:49
Create github pages in a natural way by making gh-pages a submodule of master
# Create gh-pages branch
git checkout --orphan gh-pages
# Remove all files from the old working tree
git clean -fdx
# Create initial index.html file
echo "My github page" > index.html
# Turn off jekyll
@evanmoran
evanmoran / bash_terminal_open_by_theme
Created March 20, 2012 02:07
Bash script to open new terminal windows / tabs by theme
function terminal_open {
osascript -e 'tell application "Terminal" to activate' \
-e 'tell application "System Events"' \
-e 'tell process "Terminal"' \
-e "tell menu item \"${1}\" of menu \"New ${2}\" of menu item \"New ${2}\" of menu \"Shell\" of menu bar item \"Shell\" of menu bar 1" \
-e 'click' \
-e 'end tell' \
-e 'end tell' \
-e 'end tell' > /dev/null
}
@evanmoran
evanmoran / markdown.md
Created March 15, 2012 01:27
Markdown

Markdown

Markdown is written in plain text but generates HTML. Links and formatting can be placed inline, as can code blocks.

Basics