Skip to content

Instantly share code, notes, and snippets.

# breaks array to buckets delimited by a specified item
def buckets array, &block
buckets = []
while true
cur = array.find_index &block
buckets << array unless cur
break unless cur
buckets << array[0...cur] if cur > 0
array = array.drop(cur+1)
end
@theirix
theirix / growl-1.4.patch
Created August 26, 2012 10:04
Growl 1.4 build instructions
diff -r 234c34a9d09b GrowlVersion.h
--- a/GrowlVersion.h Wed May 30 00:37:42 2012 -0500
+++ b/GrowlVersion.h Mon Jul 30 16:48:13 2012 +0400
@@ -1,8 +1,8 @@
#define COMMENT_1 DO NOT EDIT THE VERSION IN THIS FILE!
#define COMMENT_2 In case you're wondering why we're using #define for comments: This header is #imported into both Objective-C code and XML Info.plist files.
-#define GROWL_VERSION 1.4
-#define GROWL_VERSION_STRING "1.4"
+#define GROWL_VERSION 1.4i
@theirix
theirix / gist:3486805
Created August 27, 2012 09:05
brew install -v librsvg
/usr/bin/env perl -e use XML::Parser
==> Downloading http://ftp.gnome.org/pub/GNOME/sources/librsvg/2.36/librsvg-2.36.1.tar.xz
Already downloaded: /Library/Caches/Homebrew/librsvg-2.36.1.tar.xz
xz -dc "/Library/Caches/Homebrew/librsvg-2.36.1.tar.xz" | /usr/bin/tar xf -
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/librsvg/2.36.1 --disable-Bsymbolic --enable-tools=yes --enable-pixbuf-loader=yes --enable-introspection=no
./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/librsvg/2.36.1 --disable-Bsymbolic --enable-tools=yes --enable-pixbuf-loader=yes --enable-introspection=no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
@theirix
theirix / gist:3486806
Created August 27, 2012 09:05
brew doctor
Warning: You may have installed MacGPG2 via the package installer.
Several other checks in this script will turn up problems, such as stray
dylibs in /usr/local and permissions issues with share and man in /usr/local/.
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
2to3
awk
cdiff
@theirix
theirix / Makefile.prog.in.patch
Created September 16, 2012 15:18
open-jade formula patch for build on osx
--- Makefile.prog.in Tue Jan 22 06:57:53 2002
+++ Makefile.prog.in Tue Jun 11 15:54:36 2002
@@ -12,7 +12,7 @@
ALL_LIBS = $(XLIBS) $(LIBS)
Makefile.lt:
- echo 'LT_LIBS='`echo $(XLIBS)|sed 's/\.a/.la/g'` >Makefile.lt
+ echo 'LT_LIBS='`echo $(XLIBS)|sed 's/\.a/.la/g;s/libosp.la/libosp.dylib/g'` >Makefile.lt
PROG:=$(shell echo "$(PROG)" | sed '@program_transform_name@')
@theirix
theirix / default-ctor.patch
Created September 16, 2012 15:13
open-jade clang formula patch
Index: jade/TeXFOTBuilder.cxx
===================================================================
--- jade/TeXFOTBuilder.cxx
+++ jade/TeXFOTBuilder.cxx
@@ -92,6 +92,8 @@ public:
PageFloatNIC nic_;
StringC name_;
StringC placement;
+ public:
+ PageFloatFlowObj() { }
Warning: You may have installed MacGPG2 via the package installer.
Several other checks in this script will turn up problems, such as stray
dylibs in /usr/local and permissions issues with share and man in /usr/local/.
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libmacfuse_i32.2.dylib /usr/local/lib/libmacfuse_i64.2.dylib /usr/local/lib/libosxfuse_i32.2.dylib /usr/local/lib/libosxfuse_i64.2.dylib
Warning: Unbrewed .la files were found in /usr/local/lib.
@theirix
theirix / check-git-update.rb
Created December 11, 2012 13:45
Checks for git update
#!/usr/bin/env ruby
require 'rubygems'
require "atom/feed"
require "open-uri"
feed = Atom::Feed.new "http://code.google.com/feeds/p/git-core/downloads/basic"
feed.update!
titles = feed.entries.first(5).map { |e| e.title.to_s.strip }
latest_versions = titles.map { |s| Gem::Version.new($1) if s =~ /git.*-([0-9\.rc]+)\./ }.
@theirix
theirix / patch-zz-vncaddress.patch
Created December 12, 2012 20:04
Patch for emulators/virtualbox-ose (4.1.22) on FreeBSD. Allows to specify a listen port for a VNC server.
--- src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp.orig 2012-12-12 23:26:55.241729935 +0400
+++ src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp 2012-12-12 23:23:46.365727984 +0400
@@ -476,6 +476,7 @@
#ifdef VBOX_WITH_VNC
" -n, --vnc Enable the built in VNC server\n"
" -m, --vncport <port> TCP port number to use for the VNC server\n"
+ " -q, --vncaddress <ipaddr> IP address or host name to use for the VNC server\n"
" -o, --vncpass <pw> Set the VNC server password\n"
#endif
" -v, -vrde, --vrde on|off|config Enable (default) or disable the VRDE\n"
@theirix
theirix / gist:5577672
Created May 14, 2013 17:10
bash minimal color
export GNU_COLORS='di=1;34:ln=36:so=33:pi=33:ex=32:bd=33:cd=33;40:su=32;41:sg=34;41:tw=1;34;42:ow=1;31;42:or=36;41:'
export PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\\$\[\033[00m\] "
alias ls="ls --color=auto"
alias grep="grep --color=auto"