View sync.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Kenneth Reitz's GitHub Syncer
This script uses the GitHub API to get a list of all forked, mirrored, public, and
private repos in your GitHub account. If the repo already exists locally, it will
update it via git-pull. Otherwise, it will properly clone the repo.
It will organize your repos into the following directory structure:
View 0_urllib2.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
View future.py
import requests
session = requests.AsyncSession()
async def _main():
rs = []
for _ in range(100):
rs.append(await session.get('http://httpbin.org/get'))
print(rs)
View phabricator_readme.md

Phabricator Ubuntu 16.04 Installation Guide (Updated)

This is a supplement to the official Phabricator Installation Guide, because their guide will leave you with all kinds of permission and config errors and ~15,000 setup issues on startup.

Install Apache and php7.1

$ apt install apache2

$ sudo apt-get install -y python-software-properties
View Markov+Kenneth.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View install.sh
#!/usr/bin/env bash
# Install Xcode Command Line Tools.
xcode-select --install
# Install Homebrew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install brew basics (auto-updating).
brew install terminal-notifier
View install.sh
#!/usr/bin/env bash
# Install Xcode Command Line Tools.
xcode-select --install
# Install Homebrew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install brew basics (auto-updating).
brew install terminal-notifier
View background.html
<script>
chrome.browserAction.onClicked.addListener(function(tab) {
var script = "function iprl5(){var d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location;try{if(!b)throw(0);d.title='(Saving...) '+d.title;z.setAttribute('src',l.protocol+'//www.instapaper.com/j/pUgLJLCrwjg0?u='+encodeURIComponent(l.href)+'&t='+(new Date().getTime()));b.appendChild(z);}catch(e){alert('Please wait until the page has loaded.');}}iprl5();void(0)"
chrome.tabs.executeScript(tab.id, {code: script});
});
</script>
View nomination.md

Kenneth Reitz

New Board Member.

Hello, my name is Kenneth Reitz, and I'm a lover of Python. I'm mostly well known for being the author of the Requests library, Python-Guide.org, and many others.

I have spent a large amount of my time over the past five–six years giving talks about Python at many of the major user groups in the US, as well as keynoting/speaking at large Python events around the world. Many of these talks were about the future sustainability of Python and other open source projects.

Python is a core and integral part of my life, and it would be an honor to help steward the direction of the community by serving on the board. I have a plethora of free time, and I can't think of a better way to utilize it.

View tsplit.py
def tsplit(string, delimiters):
"""Behaves str.split but supports multiple delimiters."""
delimiters = tuple(delimiters)
stack = [string,]
for delimiter in delimiters:
for i, substring in enumerate(stack):
substack = substring.split(delimiter)
stack.pop(i)