Skip to content

Instantly share code, notes, and snippets.

@KellenJohn
KellenJohn / speedup.py
Created March 28, 2020 08:58 — forked from wzpan/speedup.py
A python script to speed up the rendering process of Hexo 3.
#!/usr/bin/python2
'''
SYNOPSIS:
$ python speedup.py -f FILE
or
$ python speedup.py -d DIR
'''
@KellenJohn
KellenJohn / timestamp.py
Created March 28, 2020 08:57 — forked from wzpan/timestamp.py
Python - timestamp
import datetime
# 2012-12-15 10:14:51.898000
print datetime.datetime.utcnow()
# The now differs from utcnow as expected
# otherwise they work the same way:
# 2012-12-15 11:15:09.205000
print datetime.datetime.now()
@KellenJohn
KellenJohn / raise.py
Created March 28, 2020 08:56 — forked from wzpan/raise.py
Python - raise
#!/usr/bin/python
# Filename: raising.py
class ShortInputException(Exception):
'''A user-defined exception class.'''
def __init__(self, length, atleast):
Exception.__init__(self)
self.length = length
self.atleast = atleast
try: