Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
NEW_STATE=$1
MVN_PROXY=env-proxy
SETTINGS_XML="$HOME/.m2/settings.xml"
STATE=`grep -A 1 $MVN_PROXY "$SETTINGS_XML" | tail -1 | sed -e 's#[ ]*<active>\([a-z]*\)</active>#\1#'`
#!/bin/bash
# make sure, script is sourced
EXECUTED=`echo "$BASH"`
if [[ "$EXECUTED" != "" ]]; then
echo "the script must be sourced not executed. Aborting"
exit 1
fi
# make sure, script runs on OS X
#!/usr/bin/perl -w
use strict;
# Replace everything between two two regexes (inclusive).
# The whole file is considered, so the matching block can span multiple lines
# The multi-line matching syntax of sed is (for me) total gibberish
# and having a replacement with newlines was just PITA
# therefore this simple script to replace everything bewteen two
# regexes by a (possibly) multi-line replacement
#!/usr/bin/python
import pacparser
pacparser.init()
pacparser.parse_pac_file('/tmp/proxy.pac')
proxy = pacparser.find_proxy('http://www.google.com', 'www.google.com')
print proxy
pacparser.cleanup()
@kontrafiktion
kontrafiktion / patch-path.c.diff
Created February 24, 2012 12:55
subversion unicode-path patch MacPorts svn 1.7.3
--- subversion/libsvn_subr/path.c 2007-05-01 07:21:03.000000000 +0900
+++ subversion/libsvn_subr/path.c 2007-11-04 23:18:05.000000000 +0900
@@ -31,6 +31,9 @@
#include "svn_io.h" /* for svn_io_stat() */
#include "svn_ctype.h"
+#if defined(DARWIN)
+#include <CoreFoundation/CoreFoundation.h>
+#endif /* DARWIN */
@kontrafiktion
kontrafiktion / gist:4389569
Created December 27, 2012 16:25
Alternate script to convert MultiMarkdown inline links to references (based on script by Brett Terpstra -- http://brettterpstra.com/project/markdown-service-tools/) Uses the link text instead of the URLs to create the reference names.
#!/usr/bin/env ruby
def e_sh(str)
str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').gsub(/\n/, "'\n'").sub(/^$/, "''")
end
def mmd_linkname(str)
str.gsub(/[^a-zA-Z0-9]/n, '')
end
@kontrafiktion
kontrafiktion / gist:6260945
Created August 18, 2013 10:20
Gradle 1.7 IllegalAccessError on OSX
java.lang.IllegalAccessError: tried to access class org.jruby.ext.posix.BaseNativePOSIX from class org.gradle.internal.nativeplatform.filesystem.FileSystemServices
at org.gradle.internal.nativeplatform.filesystem.FileSystemServices.addServices(FileSystemServices.java:62)
at org.gradle.internal.nativeplatform.filesystem.FileSystemServices.<clinit>(FileSystemServices.java:38)
at org.gradle.internal.nativeplatform.filesystem.FileSystems$DefaultFileSystem.<clinit>(FileSystems.java:29)
at org.gradle.internal.nativeplatform.filesystem.FileSystems.getDefault(FileSystems.java:22)
at org.gradle.initialization.LayoutCommandLineConverter.convert(LayoutCommandLineConverter.java:42)
at org.gradle.launcher.cli.BuildActionsFactory.createAction(BuildActionsFactory.java:106)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.createAction(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:196)
at org.gra

Keybase proof

I hereby claim:

  • I am kontrafiktion on github.
  • I am kontrafiktion (https://keybase.io/kontrafiktion) on keybase.
  • I have a public key whose fingerprint is 254B 57A6 08B3 1F9A 5F08 64B6 EC00 EF9F C787 7307

To claim this, I am signing this object:

on processMessage(theMessage)
try
tell application "Airmail"
set subj to subject of theMessage
set theURL to the selectedMessageUrl
end tell
set urlEncodedSubj to urlencode(subj)
set createTaskURL to "goodtask3://add?title=" & urlEncodedSubj & "&url=" & urlencode(theURL) & "&due=08:45" & "&alarm=08:45" & "&list=work"
do shell script "open \"" & createTaskURL & "\""
set selectTaskURL to "goodtask3://task?title=" & urlEncodedSubj