Skip to content

Instantly share code, notes, and snippets.

View appeltel's full-sized avatar
💭
🚡

Eric Appelt appeltel

💭
🚡
View GitHub Profile
@appeltel
appeltel / clopen.py
Last active March 24, 2018 20:56
Sorry, We're Clopen.
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 June 1, 2017 01:34
Simple asyncio streams redis client for GET/SET
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 July 29, 2023 21:17
asyncio pubsub example
import asyncio
import random
class Hub():
def __init__(self):
self.subscriptions = set()
def publish(self, message):
@appeltel
appeltel / package_getter.py
Last active December 16, 2016 22:41
Grab all release artifacts from public pypi for a given package and version
"""
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 July 29, 2016 12:32
Get openssl deps working for python crypto on OSX 10.11 with brew
# 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"