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 / 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 / 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
#!/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
# ----------
-- 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:
@geoff-nixon
geoff-nixon / openvisor.app.tar.gz
Last active August 29, 2015 13:56
Open Finder windows in new Visor tabs.
@geoff-nixon
geoff-nixon / system-icu4c.rb
Created January 17, 2014 19:00
Use the system ICU instead of having to build it from scratch.
require 'formula'
class Icu4c < Formula
homepage 'http://site.icu-project.org/'
if %x(sw_vers -productVersion|cut -c 4-5|sed 's/\\.//').chomp.to_i >= 9 and
# This is a demo, so it only works with 10.9, due to the difference in
# header files between major OS version.
@geoff-nixon
geoff-nixon / tongue-tied
Created December 28, 2013 09:41
Fork; click edit; click cancel. And...
Here is a string that cannot be decoded in line mode: �.
@geoff-nixon
geoff-nixon / linguist.md
Last active January 1, 2016 13:49
Performance stats with GitHub linguist.

Selected Repos (i.e., don't fail without patch)

    Key: [-head-] {+with patch+}

==================================================

Whole Directory


bash -c 'time -p linguist .' 2>&1

real [-142.18-]{+229.29+}

@geoff-nixon
geoff-nixon / fullpath
Created December 21, 2013 16:40
Obtain the full real path of a shell script from within the script, even if it is invoked as a symbolic link or with a different name. Written in compatible POSIX shell; works in bash, dash, and ksh. Identical to 'linkread', just another name.
#!/bin/sh # dash bash ksh # !zsh (issues). G. Nixon, 12/2013. Public domain.
## 'linkread' or 'fullpath' or (you choose) is a little tool to recursively
## dereference symbolic links (ala 'readlink') until the originating file
## is found. This is effectively the same function provided in stdlib.h as
## 'realpath' and on the command line in GNU 'readlink -f'.
## Neither of these tools, however, are particularly accessible on the many
## systems that do not have the GNU implementation of readlink, nor ship
## with a system compiler (not to mention the requisite knowledge of C).
@geoff-nixon
geoff-nixon / linkread
Created December 21, 2013 16:34
Fully dereference symbolic links (find the full path of the target file) in pure POSIX.
#!/bin/sh # dash bash ksh # !zsh (issues). G. Nixon, 12/2013. Public domain.
## 'linkread' or 'fullpath' or (you choose) is a little tool to recursively
## dereference symbolic links (ala 'readlink') until the originating file
## is found. This is effectively the same function provided in stdlib.h as
## 'realpath' and on the command line in GNU 'readlink -f'.
## Neither of these tools, however, are particularly accessible on the many
## systems that do not have the GNU implementation of readlink, nor ship
## with a system compiler (not to mention the requisite knowledge of C).