This file contains hidden or 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
atsukunareyumemitaasuwo | |
熱くなれ夢見た明日を | |
kanarazuitsukatsukamaeru | |
必ずいつかつかまえる | |
hashiridasefurimukukotonaku | |
走り出せ振り向くなれことなく | |
tsumetaiyowotsukinukero | |
冷ろnankagamunedesakenderunoni | |
何かが胸で叫んでるのに | |
kizukanufuridesugoshiteta |
This file contains hidden or 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
######## | |
# auto # | |
######## | |
class M(type): | |
def __new__(mcls, *a, **kw): | |
print("in metaclass M - __new__:", locals()) | |
return super().__new__(mcls, *a, **kw) | |
def __init__(cls, name, base, dicts): |
This file contains hidden or 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
# Singleton.py | |
class SingletonClass: | |
# __init__ will be triggered if the obj returned from __new__ is instance of __class__ | |
# thus __init__ should also check | |
_ = None | |
def __new__(cls, *a, **kw): | |
if cls._: | |
return cls._ | |
else: |
This file contains hidden or 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
'Ref: http://winaero.com/blog/how-to-view-your-product-key-in-windows-10-windows-8-and-windows-7/ | |
Option Explicit | |
Dim objshell,path,DigitalID, Result | |
Set objshell = CreateObject("WScript.Shell") | |
'Set registry key path | |
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" | |
'Registry key value | |
DigitalID = objshell.RegRead(Path & "DigitalProductId") |
This file contains hidden or 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
from string import printable | |
for i in printable: | |
try: | |
print repr(i), eval('"\%s"' % i) | |
except: | |
pass |
This file contains hidden or 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
from itertools import combinations | |
def checkio(bunker): | |
class Point: | |
def __init__(self, x, y): | |
self.x, self.y = x, y | |
def __repr__(self): | |
return "Point({},{})".format(self.x, self.y) |
This file contains hidden or 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
def check_job_status(job): | |
if job.status=='error': | |
raise Exception | |
def task(...): | |
""" | |
It is a task of thread. When it detects job (parent) failed, | |
it should stop and raise exception so that the thread stop, too. | |
""" | |
try: |
This file contains hidden or 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
http://davidscottlyons.com/threejs/presentations/frontporch14/#slide-9 |
This file contains hidden or 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 functools | |
# decorator for method?! | |
class Cache(object): | |
def __init__(self, func): | |
self.func = func | |
self.cache = {} | |
def __call__(self, *args): | |
if args not in self.cache: |
This file contains hidden or 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 functools | |
import sys | |
logger = lambda: 0 | |
logger.info = lambda s: sys.stdout.write(s+'\n') | |
logger.error = lambda s: sys.stdout.write(s+'\n') | |
def retry(tries, exceptions, logger): | |
def retry_dec(func): |