Skip to content

Instantly share code, notes, and snippets.

View geoff-nixon's full-sized avatar

Geoff Nixon geoff-nixon

View GitHub Profile
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@geoff-nixon
geoff-nixon / xzd.c
Created November 22, 2013 06:55
xzd.c — This is the userland portion of XZ embedded, concatenated info a single file; compiles to ~15k. Supports all xz (de)compression methods.
/*
* XZ Embedded
*
* Author: Lasse Collin <[email protected]>
*
* This file has been put into the public domain.
* You can do whatever you want with this file.
*/
#include <stdint.h>
#include <stdbool.h>
@geoff-nixon
geoff-nixon / xzd.c.xz
Last active December 29, 2015 03:19
xzd.c.xz (same source file, xz-compressed.)
@geoff-nixon
geoff-nixon / xzd-js-demo.sh
Created November 22, 2013 21:49
xzd/emscripten problem.
#!/bin/sh
echo
echo 'Grab xzd.c.'
echo
echo 'curl -Ls https://gist.github.com/g-nix/7595928/raw/xzd.c > xzd.c'
echo
sleep 2
echo
echo 'A copy of the same file, compressed with xz.'
echo
@geoff-nixon
geoff-nixon / get-jsc
Last active December 29, 2015 07:18
Download and extract the 'jsc' JavaScriptCore utility from the latest WebKit nightly build. The executable and library are packaged into a self-extracting/self-executing script so that it avoids the system JavaScriptCore framework (and doesn't require installing a conflicting one.)
#!/usr/bin/env LASTBUILD=159732 DATE=20131124 sh # 2013 G. Nixon. Public domain.
# Download and extract the 'jsc' utility from the latest WebKit nightly.
# Since the WebKit project neither uses the date of the build in its URIs nor
# posts a convenience 'latest' link, we record the last known build number and
# the date, then basically brute-force the URI with curl. The executable and
# framework are extracted from the disk image and then packaged into a
# self-extracting/self-executing script so that it avoids the system framework,
# and doesn't require installing a conflicting one. Not ideal, but...
@geoff-nixon
geoff-nixon / dirlink
Created November 28, 2013 12:57
dirlink — ln with support for directory hard links and "hard linking" symbolic links For Darwin. Needs some reformatting, but it works! Install in your path **as** ln for best results.
@geoff-nixon
geoff-nixon / no-utimensat.patch
Last active December 29, 2015 22:49
No futimesat/utimensat on Darwin (any many others, it think) — patch for bindfs % cd26 $ 1-Dec-13
#!/bin/sh # or, ( curl -L http://git.io/RkCAYg>p;sh ./p ) # bindfs @ cd26 #3
#---------------------------------------------------------------------------#
echo; patch -p0 < "$0" && rm "$0" && exit 0 || exit 1 # ------8<------
Index: src/bindfs.c --- +++ --- +++ --- +++ --- src/bindfs.c +++ src/bindfs.c
----------------------------------------------------------------------------=
@@ -180 +180 @@
-static int bindfs_utimens(const char *path, const struct timespec tv[2]);
+static int bindfs_utime(const char *path, struct utimbuf *buf);
@@ -693 +693 @@
-static int bindfs_utimens(const char *path, const struct timespec tv[2])
@geoff-nixon
geoff-nixon / tickoff
Created December 9, 2013 13:45
Safely replace `backticks` with POSIX-style $(command substitutions) in scripts.
#!/bin/sh # tickoff -- G.Nixon, 2013. Public Domain.
# Safely replace backticks with POSIX "$()" style command substitutions.
# Takes a shell script (from stdin, or as parameters) and replaces pairs of
# backticks with $(substitutions), per line. If a backtick is unmatched
# or escaped, returns an error with the offending line number.
case "$1" in *elp|-h) echo 'Usage: tickoff [script ...]'; echo
echo ' Replace `backticks` with $(command substitutions).'; echo '
Takes shell script (from stdin, or as parameters) and replaces pairs of
@geoff-nixon
geoff-nixon / aviary
Last active December 31, 2015 02:59
#!/bin/sh
ECLIPSEMAJORVER=4; DROP=S-4.4M3-201310302000; ECJVER=4.4M3; LZMASDKVER=922
JDKREL=7u45; JDKBLD=b18; SRCREL=7u40; SRCBLD=b43; SRCDATE=26_aug_2013
cd "$(dirname "$0")"; HUR="$(pwd)"
info(){ echo 'Aviary: Download and configure extras to use with avian.'
echo ''
echo ' aviary [patch] | [get [all] | [component ...]]'
echo ''
require 'rubygems'
require 'rubygems/package'
require 'zlib'
require 'fileutils'
module Util
module Tar
# Creates a tar file in memory recursively
# from the given path.
#