NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
#!/usr/bin/python | |
from urllib2 import urlopen | |
from json import loads | |
from xml.dom.minidom import parseString | |
from datetime import datetime, timedelta | |
from math import floor | |
TRIMET_API_KEY = "" # redacted for privacy |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
import weather | |
import smtp | |
''' | |
Send a greeting email to our customer email list | |
with the daily weather forecast and schedule | |
''' | |
def get_emails(): | |
# Reading emails from a file |
This is a continuation of my buffer pre-write hook series. Check out the previous gist to follow the progression.
Have you ever tried running a file only to be stopped by "<<<<<<<"?
Wouldn't it be nice to be able to automatically run your code through pyflakes before actually saving it? Maybe even raise an error for showstopping bugs in your code?
dash_sniffer.service
/lib/systemd/system/
systemd
using command: systemctl daemon-reload
systemctl enable dash_sniffer.service
'''Simple tictactoe game, board positions are like keyboard | |
7 8 9 | |
4 5 6 | |
1 2 3 | |
''' | |
from builtins import input | |
from collections import Counter | |
from functools import wraps | |
import itertools |
development https://git.heroku.com/xxx.git (fetch)
development https://git.heroku.com/xxx.git (push)
origin git@bitbucket.org:xxx/xxx.git (fetch)
origin git@bitbucket.org:xxx/xxx.git (push)
production https://git.heroku.com/xxx.git (fetch)
production https://git.heroku.com/xxx.git (push)
staging https://git.heroku.com/xxx.git (fetch)
Short (72 chars or less) summary
More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).
Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
#!/bin/bash | |
ps awxx | grep $1 | grep -v get_pid | grep -v grep | awk '{print $1}' |
from datetime import datetime, timedelta | |
PYBITES_BORN = datetime(year=2016, month=12, day=19) | |
def my_gen_special_pybites_dates(): | |
days = 1 | |
while True: | |
dt = PYBITES_BORN + timedelta(days=days) | |
# if days % 100 == 0: # commented to print only 'every year' |