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 datetime | |
import os | |
time = datetime.time(tzinfo=datetime.timezone(datetime.timedelta(0))) | |
time = time.strftime("%H:%M:%S %z") | |
for entry in os.listdir(): | |
if not entry.endswith(".py"): | |
date = datetime.date(int(entry[:4]), int(entry[4:6]), int(entry[6:])) | |
date = date.strftime("%Y-%m-%d %a") |
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/env python | |
import subprocess | |
import os | |
FILE = os.environ['HOME'] + '/.task/pending.data' | |
x = subprocess.check_output([ | |
'task', 'status:recurring', 'until.before:today', 'ids']) | |
x = x.decode().rstrip() |
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 os | |
import re | |
p_heading = re.compile(r'(=+) (.*?) =+') | |
p_code = re.compile(r'</?code>') | |
p_link = re.compile(r'\[\[([^|\]]+)\|([^\]]+)\]\]') | |
p_inlink = re.compile(r'\[\[([^|\]]+)\]\]') | |
files = [x for x in os.listdir() if x.endswith('.txt')] | |
for x in files: |
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 SwitchCase: | |
""" | |
Simple implementation of switch-case statements in Pythonic style. | |
>>> switch = SwitchCase() | |
Adding case handlers: | |
>>> @switch.case('foo') |
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
<br /> | |
<h1>Heading one</h1> | |
<h2>Header two</h2> | |
<h3>Header three</h3> | |
<h4>Header four</h4> | |
<h5>Header five</h5> | |
<h6>Header six</h6> | |
<p>This is a copy of one of the sample pages from the <a href="http://www.wordpress.org" onclick="_gaq.push(['_trackEvent', 'outbound-article', 'http://www.wordpress.org', 'WordPress']);" >WordPress</a> theme development test content. I found it handy to keep a copy of this for building sites that aren’t using WordPress. 99% of the credit goes to them, I’m just hosting it in a handy place in case it’s useful to anyone other than me.</p> | |
<h2>Blockquote Tests</h2> | |
<p>Blockquote:</p> |
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 MultiMethod: | |
def __init__(self, func): | |
self.func = func | |
self.methods = {} | |
def __call__(self, *args, **kwargs): | |
return self.methods[self.func(*args, **kwargs)](*args, **kwargs) | |
def method(self, case): |
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
(use-package delight) | |
(add-to-list 'use-package-keywords :delight t) | |
(defun use-package-normalize/:delight (name-symbol keyword args) | |
"Normalize arguments to delight." | |
(cond | |
((and (= (length args) 1) | |
(symbolp (car args))) | |
(list (car args) nil name-symbol)) |
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/env python3 | |
(lambda sys:(lambda input:(lambda ilen:(lambda m,olen:(lambda star:(lambda f,g:None)(list(map(lambda i:(lambda b:list(map(lambda x,y: star[x].__setitem__(y,input[i]),[i,b,m,m,i,i,b,b],[m,m,i,b,i,b,i,b])))(olen-i-1),range(ilen))),print("\n".join("".join(char for char in row) for row in star))))([[" " for x in range(olen)] for x in range(olen)]))(ilen-1,2*ilen-1))(len(input)))(sys.argv[1]))(__import__('sys')) |
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
(defun star (input) | |
"Make star." | |
(let* ((l (length input)) | |
(lo (- l 1)) | |
(ll (- (* 2 l) 1)) | |
(star (make-array (list ll ll) :initial-element #\Space))) | |
(dotimes (i l) | |
(let ((a (+ 0 i)) | |
(b (- ll i 1))) | |
(map nil (lambda (x y) (setf (aref star x y) (aref input i))) |
OlderNewer