Skip to content

Instantly share code, notes, and snippets.

View jtwaleson's full-sized avatar

Jouke Waleson jtwaleson

View GitHub Profile
val filteredMap = sort.filterKeys(path =>
!parsePath(entityName, path).attribute.isVirtual)
public class RestHandler extends RequestHandler
{
@Override
public void processRequest(IMxRuntimeRequest request, IMxRuntimeResponse response, String path) throws Exception
{
Core.getLogger("RestHandler").info("Received request for path '" + path + "', resourcepath '" + request.getResourcePath() + "'.");
String[] pathParts = request.getResourcePath().split("/");
String queryName = pathParts[pathParts.length-1];
// BEGIN USER CODE
Core.addRequestHandler("hello/", new HelloWorldRequestHandler());
Core.getLogger("RequestHandlers").info("Registered Hello World requesthandler for 'hello/'");
return true;
// END USER CODE
public class HelloWorldRequestHandler extends RequestHandler {
@Override
public void processRequest(IMxRuntimeRequest request, IMxRuntimeResponse response, String path) throws Exception
{
String greeting = "Hello world!";
OutputStream outputStream = response.getOutputStream();
IOUtils.write(greeting, outputStream);
IOUtils.closeQuietly(outputStream);
}
@jtwaleson
jtwaleson / hall.py
Created April 15, 2012 14:15
D - Hall of Mirrors
from sys import stdin
from math import ceil, sqrt
def rline():
return stdin.readline().rstrip()
def sign(p):
if p < 0:
return -1
elif p > 0:
return 1
else:
@jtwaleson
jtwaleson / recycled.py
Created April 15, 2012 14:12
C - Recycled Numbers
from sys import stdin
def rline():
return stdin.readline().rstrip()
for l in range(int(rline())):
(n,m) = map(int, rline().split())
total = 0
length = len(str(n))
for k in range(n, m+1):
s1 = str(k)
@jtwaleson
jtwaleson / dancing.py
Created April 15, 2012 14:12
B - Dancing with the Googlers
def rline():
return stdin.readline().rstrip()
for i in range(int(rline())):
data = map(int, rline().split())
googlers = data[0]
surprising = data[1]
p = data[2]
scores = data[3:]
num = 0
@jtwaleson
jtwaleson / speaking_in_tongues.py
Created April 15, 2012 14:06
A - Speaking in Tongues
english = "zq our language is impossible to understand there are twenty six factorial possibilities so it is okay if you want to just give up"
googlerese = "qz ejp mysljylc kd kxveddknmc re jsicpdrysi rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd de kr kd eoya kw aej tysr re ujdr lkgc jv"
mapping = dict(zip(googlerese, english))
lines = map(lambda x: x.strip(), stdin.readlines())
for i in range(1, len(lines)):
print "Case #%s: %s" % (i, "".join([mapping[char] for char in lines[i]]))