Skip to content

Instantly share code, notes, and snippets.

View geoff-nixon's full-sized avatar

Geoff Nixon geoff-nixon

View GitHub Profile
@geoff-nixon
geoff-nixon / openvisor.app.tar.gz
Last active August 29, 2015 13:56
Open Finder windows in new Visor tabs.
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer:
#!/usr/bin/env ksh # solarized "iterm-24bit" proof-of-concept script.
#!/usr/bin/env sh # If you don't have ksh. But beware: bash nearly dies on this.
command echo "WARNING: This script requires 24bit color and GOOD UTF-8 support."
command echo "If in doubt, ctl-C NOW. Did your terminal die? You were warned!"
echo; for i in $(seq 5 1); do command echo $i...; sleep 1; done
# The Values
# ----------
@geoff-nixon
geoff-nixon / brew-which
Created March 8, 2014 11:49
brew which -- derefernce homebrew's symlinks.
#!/usr/bin/env sh # "brew which" -- derefernce paths for homebrew symlinks.
# "brew exec" -- exec these instead of printing/returning.
# G. Nixon 2014. Public domain or license of your choice; no warranty, etc.
iam=$(echo "$(basename "$0")" | cut -c6-10); cellar="$(brew --prefix)"
bin=$cellar/bin
optbin=$cellar/opt/bin
@geoff-nixon
geoff-nixon / gmp-lto-fix.patch
Created March 18, 2014 00:37
Counteract effect of LTO on GMP's FP format detection.
index: a/acinclude.m4 b/acinclude.m4
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -3273,0 +3274,38 @@
+
+
+# Test generated assembly for markers of unusual "objects" that cause test to fail.
+
+# Compilers sometimes generate "strange objects" - things that are not machine code,
+# but instead, some type of intermediately processed data (i.e., LTO/IPO/WPA/IR).
@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 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 / 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 ...
@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