This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream dtutorapp { | |
server 127.0.0.0:9001; | |
} | |
server { | |
listen 80 default_server; | |
server_name _; | |
root /home/dtutor/dtutor/app/static/; | |
keepalive_timeout 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class A(object): | |
... def __add__(self, o): return "add" | |
... | |
... class B(A): | |
... def __radd__(self, o): return "radd" | |
>>> A() + B() | |
0: 'add' | |
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AB(): | |
def function1(self, eingabe): | |
print(eingabe) | |
tokenDict = {'vE':function1} | |
a = AB() | |
test = a.tokenDict['vE'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# smallest positive t such that s+t*ds is an integer | |
intbound = (s, ds) -> | |
if ds < 0 | |
intbound -s, -ds | |
else | |
s = mod s, 1 | |
return (1 - s) / ds | |
signum = (x) -> if x > 0 then 1 else (if x < 0 then -1 else 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Feel free to modify and use this filter however you wish. If you do, | |
# please give credit to SethBling. | |
# http://youtube.com/SethBling | |
#from pymclevel import TAG_Long | |
# Performs signed overflow and underflow for Java's long. | |
# NOTE apparently not required. | |
def jlong(x): | |
# Signed overflow. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
bool initOnce(alias var)(lazy typeof(var) init) | |
{ | |
static bool hasInitialised = false; | |
if(!hasInitialised) | |
{ | |
var = init(); | |
hasInitialised = true; |