Skip to content

Instantly share code, notes, and snippets.

@Orangenhain
Orangenhain / test_color-completion-descriptions.zsh
Last active April 17, 2017 20:59
zsh completion - partial coloring issues
# - start a clean shell with `zsh -f`
# - `source` this file
# - `a -<tab>` WILL show color
# - `a --<tab>` will NOT show color
# - `b -<tab>` will NOT show color
# - `c <tab>` will NOT show color
# if you uncomment the line after "YYY", ALL examples WILL show color
# first example shows up as expected (only option is red, rest is normal)
@Orangenhain
Orangenhain / add_minimum-file-size_option.diff
Created December 19, 2013 00:49
patch to add `minimum file size` option to duff
From d94859fa294d9974563b48195b7430a36c15d651 Mon Sep 17 00:00:00 2001
From: OrangeRaven <apfelsinenhain@gmx.de>
Date: Thu, 19 Dec 2013 01:45:16 +0100
Subject: [PATCH] Add option option for minimum file size ( `-m _size_` ) ...
don't check files smaller than this.
---
src/duff.c | 16 ++++++++++++++--
src/duffdriver.c | 6 +++++-
2 files changed, 19 insertions(+), 3 deletions(-)
@Orangenhain
Orangenhain / mattext_on_Mavericks.diff
Last active December 29, 2015 17:29
diff of changes to CMakeLists.txt to make mattext compile on Mavericks needs argp-standalone from homebrew ; and you most likely need to change the paths to homebrew
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 75b6077..d969bc3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories(/opt/homebrew/include)
link_directories(/opt/homebrew/lib)
- set(TARGET_LIBS argp)
endif()
@Orangenhain
Orangenhain / import_minimizer.rb
Created November 28, 2013 12:45
Script that takes a ObjC .m file and tries to find unused (or duplicate) import statements by commenting out each #import line in turn and seeing if the project still compiles. You will have to change BUILD_DIR & BUILD_CMD.
#!/usr/bin/env ruby -w
class String
def starts_with?(prefix)
prefix.respond_to?(:to_str) && self[0, prefix.length] == prefix
end
end
HEADER_REGEX = /^#import\s+["<](.*)[">]/
@Orangenhain
Orangenhain / svn-rco.rb
Created August 21, 2012 09:37
svn revision checkout -- checkout specific revision and (most importantly) checkout matching externals revision; useful if your repository has HEAD-tracking externals, but you want to compile an earlier version
#!/usr/bin/env ruby
require 'uri'
def params_valid?
lengthOkay = [2,3].include? ARGV.length
revOkay = ARGV[0].to_i.to_s == ARGV[0]
lengthOkay && revOkay
end
@Orangenhain
Orangenhain / modifierKeyState.m
Created June 25, 2012 12:48
small tool to check modifier key state on the command-line (CLI, Mac only)
// Usage:
// Basically, there are two ways to use this, either just invoke it via
// modifierKeyState
// and the exit code will be a bit mask for the state of the modifier keys,
// or:
// modifierKeyState command
// modifierKeyState shift alt
// exit code 0 means the specified keys (and only those!) have been found
// exit code 1 means the key was either not pressed, or other keys have been pressed as well
// Lastly:
@Orangenhain
Orangenhain / README.txt
Created February 10, 2012 20:10
Fix Safari links using Detox
If you use Safari and CMD+Click on a page to open it in a background tab,
the Safari History doesn't register the final URL, only the first step.
Leading to lots of links named "http://www.google.com/url?....12ASDF8234"
in your history, thus making it useless.
To fix this, one can change the Info.plist of Detox to also include the domains:
www.google.com, www.google.co.uk, www.google.XYZ, ...
( "www.google.*" apparently is an invalid pattern)
And add the following piece of code to end.js:
@Orangenhain
Orangenhain / sieve.html
Created June 11, 2011 04:27
Sieve of Eratosthenes using CSS3 selectors
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>
Sieve of Eratosthenes using CSS3 selectors (+ some JS)
</title>
<style type="text/css">
#sieve {
background-color: #EEE;
@Orangenhain
Orangenhain / fetch_asciicasts.rb
Created May 28, 2011 15:02
Fetch episodes from ASCIIcasts.com ; use existing PDF, or create one
#!/usr/bin/env ruby -U
# fetch available Railscasts transcripts ( ASCIIcasts ); use existing PDF where available
# original concept: https://github.com/korin/casts/blob/master/asciicasts/fetch.rb
# get wkhtmltopdf from: http://code.google.com/p/wkhtmltopdf/downloads/list
require 'uri'
require 'open-uri'
require 'nokogiri'
require 'pdfkit'