Skip to content

Instantly share code, notes, and snippets.

@theirix
theirix / apt-majorchanges.py
Created July 5, 2014 11:57
Find upgradable debian packages with major version changes
#!/usr/bin/env python
"""
apt-majorchanges.py
Find upgradable debian packages with major version changes
"""
import apt
__author__ = "theirix"
@theirix
theirix / check-latest-hg.rb
Created May 25, 2014 09:57
Check latest hg version for OS X 10.9
require 'open-uri'
require 'rkelly'
ast = RKelly::Parser.new.parse(open('http://mercurial.selenic.com/sources.js').read)
ast.pointcut(RKelly::Nodes::ArrayNode).matches[1..-1].each do |node|
elements = node.pointcut(RKelly::Nodes::StringNode).matches
if elements.any? { |v| v.value =~ /Mercurial.*MacOS.*10\.9/ }
puts elements[0].value[1...-1] + ' at ' + elements[2].value[1...-1]
end
end
#!/usr/bin/env ruby
# Experimentally checks bibtex database for warnings.
# latexmk and pdflatex required
require 'fileutils'
require 'ruby-progressbar'
raise 'Usage: inspectbibtex.rb BIBFILE [start_citation]' unless ARGV[0]
@theirix
theirix / poll-iron-maiden.rb
Created May 17, 2013 18:31
Checks does a wonderful Iron Maiden song hit a 666'666 scrobble count
#!/usr/bin/env ruby
require 'net/http'
require 'json'
url = "http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=644aa4f87f12b4e2904cd495366cc6b5&" +
"artist=Iron+Maiden&track=Seventh+Son+Of+A+Seventh+Son&format=json"
puts JSON(Net::HTTP.get(URI.parse(url)))['track']['playcount']
@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"
@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 / 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]+)\./ }.
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 / 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() { }