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
# see https://github.com/niccokunzmann/wwp | |
from relative import roleOf, useRoles | |
@roleOf(int) | |
class NaturalNumber: | |
@property | |
def successor(self): | |
return self + 1 |
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
''' | |
This is a module with persistent attributes | |
the attributes of this module are spread all over all instances of this module | |
To set attributes: | |
import runningConfiguration | |
runningConfiguration.x = y | |
to get attributes: | |
runningConfiguration.x |
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
buildmaglev () { | |
use ruby && | |
rake maglev:stop | |
rake stone:destroy[maglev] | |
rake build:clobber && | |
rake build:maglev && | |
rake maglev:reload_prims && | |
rake maglev:start | |
} |
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 sys | |
import traceback | |
import StringIO | |
from copy_reg import dispatch_table, pickle | |
def exc_info(hide_calls = 0): | |
'''as sys.exc_info() but returns a remote exception object''' | |
ErrorType, thrownError, traceback = sys.exc_info() | |
for i in range(hide_calls): |
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
## The MIT License (MIT) | |
## --------------------- | |
## | |
## Copyright (C) 2014 Nicco Kunzmann | |
## | |
## https://gist.github.com/niccokunzmann/6038331 | |
## | |
## Permission is hereby granted, free of charge, to any person obtaining | |
## a copy of this software and associated documentation files (the "Software"), |
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
## MIT License | |
## | |
## Copyright 2014 Nicco Kunzmann | |
## | |
## Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
## software and associated documentation files (the "Software"), to deal in the Software | |
## without restriction, including without limitation the rights to use, copy, modify, merge, | |
## publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons | |
## to whom the Software is furnished to do so, subject to the following conditions: | |
## |
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
''' | |
This is crated as an answer to the stackoverflow qustion: | |
http://stackoverflow.com/questions/21960514/can-i-use-a-processpoolexecutor-from-within-a-future | |
The updated code can be found here: | |
https://gist.github.com/niccokunzmann/9170072 | |
The RecursiveThreadPoolExecutor allows the usage of futures in the | |
submitted functions. | |
It uses the yield and yield from statements to suspend the execution of the |
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
""" | |
Response to | |
http://stackoverflow.com/a/22904200/1320237 | |
""" | |
import json.scanner | |
import json.decoder | |
from json.decoder import JSONDecoder | |
class FileString(object): |
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
#!/usr/bin/python3 | |
## The MIT License (MIT) | |
## | |
## Copyright (c) 2014 Nicco Kunzmann | |
## | |
## https://gist.github.com/niccokunzmann/9c60cb40d3d3975ef830 | |
## | |
## Permission is hereby granted, free of charge, to any person obtaining a copy | |
## of this software and associated documentation files (the "Software"), to deal |
OlderNewer