Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🚡

Eric Appelt appeltel

💭
🚡
View GitHub Profile
@appeltel
appeltel / clopen.py
Last active Mar 24, 2018
Sorry, We're Clopen.
View clopen.py
Python 3.6.4 (default, Mar 23 2018, 08:00:10)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def opencell_gen(i):
... a = i
... def f(b):
... b = a
... a = yield f.__closure__[0]
... while True:
... a = yield None
@appeltel
appeltel / redis.py
Created Jun 1, 2017
Simple asyncio streams redis client for GET/SET
View redis.py
import asyncio
def build_command(*args):
command = '*' + str(len(args)) + '\r\n'
for arg in args:
command += '$' + str(len(arg)) + '\r\n'
command += arg + '\r\n'
return command.encode('utf-8')
@appeltel
appeltel / pubsub.py
Last active Nov 15, 2021
asyncio pubsub example
View pubsub.py
import asyncio
import random
class Hub():
def __init__(self):
self.subscriptions = set()
def publish(self, message):
@appeltel
appeltel / package_getter.py
Last active Dec 16, 2016
Grab all release artifacts from public pypi for a given package and version
View package_getter.py
"""
package_getter.py - Get all release artifacts for a given package
and version from the public pypi
"""
import os
import sys
import hashlib
import requests
from bs4 import BeautifulSoup
@appeltel
appeltel / openssl_fix_python_crypto_osx10.11.sh
Last active Jul 29, 2016
Get openssl deps working for python crypto on OSX 10.11 with brew
View openssl_fix_python_crypto_osx10.11.sh
# remove your wheels
rm -r ~/Library/Caches/pip/wheels/*
# update brew
brew update
brew upgrade
brew install openssl #if needed
brew unlink openssl #if needed
# add some flags variables to your environment so your builds
# can find openssl headers and shared libs
export ARCHFLAGS="-arch x86_64"