I hereby claim:
- I am tcg on github.
- I am tommygeorge (https://keybase.io/tommygeorge) on keybase.
- I have a public key whose fingerprint is 4EB6 B9FC CF65 5C61 EBEA 8F22 5246 02EA E3D7 FF6B
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
""" | |
Some Python code to tinker with the ideas presented | |
in the Numberphile episode "How to Win a Guessing Game". | |
See: https://www.youtube.com/watch?v=ud_frfkt1t0 | |
""" | |
import random | |
import time | |
import datetime | |
import calendar | |
def get_month_day_range(date): | |
""" | |
For a date 'date' returns the start and end date for the month of 'date'. | |
Month with 31 days: | |
>>> date = datetime.date(2011, 7, 27) | |
>>> get_month_day_range(date) |
References:
class ParanoidContextProxy(object): | |
""" | |
This is a poor-man's proxy for a context instance. | |
Make sure template rendering stops immediately on a KeyError. | |
""" | |
def __init__(self, context): | |
self.context = context | |
def __getitem__(self, key): |
# List Git branches in order of most-recently-updated. | |
# https://gist.github.com/tcg/381dba155117a2e7a545 | |
alias gitbranchesbydate="git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:iso8601) %09 %(refname) %09 %(authorname)' | sed -e 's-refs/heads/--'" | |
# Output looks like: | |
# 2014-06-06 12:58:53 -0500 tcg/donate_language_updates Tommy George | |
# 2014-06-06 10:28:04 -0500 integration Brad | |
# 2014-06-05 16:13:30 -0500 super_dev_branch Chris | |
# List files that SHOULD now be ignored by .gitignore, but might not yet be. | |
# Use this if you just added your .gitignore file and want to make sure that |
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
import time | |
import sublime_plugin | |
class TimestampCommand(sublime_plugin.EventListener): | |
"""Expand `isoD`, `now`, `datetime`, `utcnow`, `utcdatetime`, | |
`date` and `time` |
/* Solarized Dark | |
For use with Jekyll and Pygments | |
http://ethanschoonover.com/solarized | |
SOLARIZED HEX ROLE | |
--------- -------- ------------------------------------------ | |
base03 #002b36 background | |
base01 #586e75 comments / secondary content |
/** | |
* Add this style to the page. It's like you can read minds. | |
* Ugly, but it works. It's a free example, alright!? | |
*/ | |
.playerPoints::after { | |
content: attr(data-point-value); | |
font-style: italic; | |
font-weight: bolder; | |
background-color: #eee; | |
padding-left: 1em; |
# pip install eyeD3 | |
import eyed3 | |
from eyed3 import mp3 | |
f = mp3.Mp3AudioFile('2-297a587f40fdc0064c44f2e5247d7bf7.mp3') | |
# Now: | |
# >>> f.info.sample_freq | |
# 24000 | |
# >>> f.info.bit_rate |