Skip to content

Instantly share code, notes, and snippets.

View rmetzler's full-sized avatar
💭
Recruiters should mention the role and salary range if you spam me.

Richard Metzler rmetzler

💭
Recruiters should mention the role and salary range if you spam me.
View GitHub Profile
package petrinet.gui;
import petrinet.logic.Arc;
import petrinet.logic.Petrinet;
import petrinet.logic.Place;
import petrinet.logic.Transition;
public class ImWechsel {
public static void main(String[] args) {
@rmetzler
rmetzler / gist:149130
Created July 17, 2009 16:10
A simple client for the fortune SOAP webservice using Python & ZSI
#
# A simple client for the fortune SOAP webservice using ZSI
#
# this is how you create the stubs and client / server classes:
#
# wsdl2py http://www.doughughes.net/WebServices/fortune/fortune.cfc?wsdl
#
#
import fortune_client
@rmetzler
rmetzler / yovistobookmarkle.js
Created November 22, 2009 19:04
this code is available as a bookmarklet at http://jsbin.com/aqiku
var s = document.createElement('script');
s.setAttribute('src', 'http://jquery.com/src/jquery-latest.js');
document.body.appendChild(s);
s.onload=function(){
function urlencode(str) {
return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}
var span = $('.tab_content span[rel=\'owl:sameAs\']');
public static <T> List<T> unmarshalList(IUnmarshaller<T> unmarshaller, DataInputStream in)
throws UnmarshalException {
try {
BufferedInputStream buff = new BufferedInputStream(in);
in = new DataInputStream(buff);
byte tag = in.readByte();
Traceback (most recent call last):
...
File "/base/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 1585, in fetch
raw = raw_query.Get(limit, offset)
File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 1079, in Get
prefetch_count=limit)._Get(limit)
File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 1021, in _Run
str(exc) + '\nThis query needs this index:\n' + yaml)
javascript:var%20s%20=%20document.createElement('script');s.setAttribute('src',%20'http://jquery.com/src/jquery-latest.js');document.body.appendChild(s);s.onload=function(){%20function%20urlencode(str)%20{%20%20%20return%20escape(str).replace('+',%20'%252B').replace('%2520',%20'+').replace('*',%20'%252A').replace('/',%20'%252F').replace('@',%20'%2540');}%20var%20span%20=%20$('.tab_content%20span[rel=\'owl:sameAs\']');var%20href%20=%20span.attr('href');var%20jsonhref%20=%20href.replace('http://dbpedia.org/resource/','http://dbpedia.org/data/')%20+%20'.json';%20span.html('<a%20href=\''%20+%20jsonhref%20+%20'\'%20>'%20+%20href%20+'</a>');%20$.ajax({%20%20dataType:%20'jsonp',%20%20url:%20'http://jsonp.appspot.com/?url='%20+%20jsonhref,%20%20success:%20function%20(json,%20textStatus)%20{%20%20%20%20var%20abstr%20=%20json[href]['http://dbpedia.org/property/abstract'][0]['value'];%20%20%20%20span.html('<p>'%20+%20abstr%20+%20'</p>');%20%20}});%20};void(s);
require 'time'
require 'json/pure' # require 'json/ext' segfaults for me
require 'twitter'
# There’s probably a way to get the path out of RubyGems itself, but I don’t know how, and the RubyGems
# documentation is a clusterfuck. )’=
require '/Users/elliottcable/.rvm/gems/ruby-1.9.2-preview1/gems/twitter-0.9.7/examples/helpers/config_store.rb'
######################################################################################################## Welcome!
# This file is ugly as fuck. Get over it, I was tired… not to mention that I hadn’t written any Ruby in, like, a
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer!
PS1='\[\033[01;32m\]\h \[\033[01;34m\]\W' #\$ \[\033[00m\]'
PS1=$PS1"\$(git branch 2>/dev/null | grep '^*' | colrm 1 2 | xargs -I {} echo ' (\[\033[01;31m\]'{}'\[\033[01;34m\])')"
export PS1=$PS1" \$ \[\033[00m\]"
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# host ~/code/web (beta_directory) $ git checkout master
import com.google.protobuf.DescriptorProtos;
import com.google.protobuf.Descriptors;
import com.google.protobuf.DynamicMessage;
import com.google.protobuf.Message;
import java.util.HashMap;
/**
* ProtobufEnvelope - allows creating a protobuf message without the .proto file dynamically.
*
// create job, set properties etc.
// instead of job.waitForCompletion(true), just do:
job.submit();
// set time out:
long maxDuration = 1000 * 120; // 120 seconds
String lastReport = null;
long start = System.currentTimeMillis();
long current = start;