Skip to content

Instantly share code, notes, and snippets.

View geoff-nixon's full-sized avatar

Geoff Nixon geoff-nixon

View GitHub Profile
#!/bin/bash
# Convert a Github Flavored Markdown Syntax file to HTML
#
# The MIT License (MIT)
# Copyright © 2012 Evertton de Lima <e.everttonlima@gmail.com>
# http://evertton.mit-license.org/
# Stylesheet feature by Dan Untenzu <mail@pixelbrackets.de>
#
# Requirements: cURL (sudo apt-get install curl)
@geoff-nixon
geoff-nixon / flavor.rb
Last active August 29, 2015 14:06 — forked from ttscoff/flavor.rb
#!/usr/bin/ruby
# Convert a Markdown README to HTML with Github Flavored Markdown
# Github and Pygments styles are included in the output
#
# Requirements: json gem (`gem install json`)
#
# Input: STDIN or filename
# Output: STDOUT
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file
# cat README.md | flavor > README.html
#!/usr/bin/env sh -x # put this in openssl-REV/MacOS and ./MacOS/X.sh
CLANGV=$(clang -v 2>&1 | head -1 | grep 3. | sed -e's|.*3\.\(.\).*|\1|') || :
[ $(uname -r|cut -c 1-2) -lt 11 ] && echo "OS version too old." >&2 && exit 1
# [ $CLANGV -lt 4 ] && echo "Clang 3.4+ is required." >&2 && exit 1
[ ! -d MacOS ] && echo "Execute from OpenSSL base directory." >&2 && exit 1
BASE=$PWD; export PATH="$BASE:$PATH"
RAND=$(od -XN16 </dev/urandom | sed -e's| ||g' -e's|^0000000.||' | head -1)
export MAKEFLAGS="-j $(sysctl -n hw.ncpu)"
# export CFLAGS="-Ofast -flto -fvectorize -fslp-vectorize"
@geoff-nixon
geoff-nixon / docman
Last active August 29, 2015 14:01
docman — single file, self-compiling `mandoc`
:;O="$(cd "$(dirname "$0")"; pwd)"; dec() { mkdir -p /tmp/.__ ; cd /tmp/.__
echo $b64 | base64 --decode | gzip -d | patch -sp1; make -s 2>/dev/null
cp mandoc "$O" && cd "$O" && rm -rf /tmp/.__ ;}; b64='
H4sIAAAAAAACA+xZa3PaStL+HH7FFOfUOdjYxFyC/TrrVDBgwy63QsROdr1FDWJAqui20oDtpLK/
/W31CGlasE6Vsx/3Q6Ke5+nLMz2j0VC2vaV4umT87ZB/FSvbEWyRmoXT01P2dim2b72N4xTK5bJO
fvzITs9Ozli5elJtVNnHj4VyZdIbj75cvjEdwb1CuVC+606N/njErli1Uq1V6oB0WrMujOtV1hGm
cBciZLWzKjDtm0Hr1mDlK3ba+WR05/ftXmsK9tgYtYbdq+JD8droPBSLCT1sjSatWQ9GvdZdd94e
j276t/NeXJU7ziVzubf0zXg46F+D83x8/VcDCgNe8dlDocwYiwdzi0cWRVxuhj6Fttyxl1yKir/L
2Bm3dyl5aGoZuJTZwLEXWiIQREdzHq63FFJ6KISCKJYqyuBIq7v1nVTqdHxzs5Mq/qXNPvRXq2wk
Fw4ZzCE7p4jDn/2NpJgfyKjiZ33W+vJ7SWv9URKUoIkbhVEqhU2LhxFZC9rESGijUPCl0tIeD2F3
@geoff-nixon
geoff-nixon / 0_reuse_code.js
Created March 27, 2014 02:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@geoff-nixon
geoff-nixon / htmlpipe.sh
Created March 22, 2014 22:19
Pipe raw HTML to browser (OS X). Also takes file arguments.
:; I="$(basename $0)"; [ -z $BROWSER ] && open=open || open="$BROWSER"
[ $# -eq 0 ] && set -- -; [ "$1" = "-" ] && [ -t 0 ] &&
echo "Usage: [ COMMAND | $I ] | [ $I < FILE ] | [ $I FILE ... ]" >&2 && exit
for what; do where="/tmp/$(od -N2 < /dev/urandom | openssl dgst -sha1).html"
cat "$what" > "$where" && $open "$where"; sleep 1 && rm -f "$where" & done
## Or, you might prefer what I use:
# cat "$what" > "$where" && qlmanage -p "$where" >/dev/null 2>&1; sleep 1 ...
#!/usr/bin/env node #// -*- Mode: Node.js JavaScript; tab-width: 4; -*-
/*
---
url: http://gist.github.com/441101
name : safari-get-html
description : safari-get-html will rock your socks!
authors : Thomas Aylott
copyright : © 2010 Thomas Aylott
license : MIT
@geoff-nixon
geoff-nixon / somebodyrandom
Last active August 29, 2015 13:57
Generate random but valid names and addresses.
#!/usr/bin/env sh # "somebodyrandom" -- random but REAL names and addresses. #
#=- G. Nixon, 2014; Public domain or license of your choice. DO NOT ABUSE. -=#
#==------------------------------------------------------------------------==#
# #
# Randomly generate (from census data and white pages) a valid name, address #
# and phone number. THIS IS NOT stealing anyone's identity, as it is public #
# information. It is not meant for harassing/spamming people, but for online #
# registration forms where this type infomation is required (and validated), #
# and one wishes to remain anonymous, along with a throw-away email address. #
# #
#!/usr/bin/env sh
COOKIEURI='http://www.adobe.com/cfusion/tdrc/index.cfm?product=acrobat_pro'
TRIALBASE='http://trials3.adobe.com/AdobeProducts/'
TRIALLINK='http://prodesigntools.com/adobe-cc-direct-download-links.html'
GETCOOKIE="$(curl -Lsc - "$COOKIEURI" -o /dev/null | grep MM_ )"
ONECOOKIE=$(echo "$GETCOOKIE" | sed 's|.*LS.||')
cookcurl(){ echo $(basename "$@"); curl -C - -ORLb MM_TRIALS='$COOKIE' "$@" ;}