A tiny utility that will move a file and put a symlink back in the original location to ensure others looking for the file will find it.
Download the files into a directory
cd
into the directory
run pip install -e .
(don't forget the .
)
import ujson as json | |
import uos as os | |
import usocket as socket | |
# todo: https | |
def http_get_async(url): | |
_, _, host, path = url.split('/', 3) | |
if ':' in host: |
import logging | |
import signal | |
import sys | |
from PyQt5 import QtGui, QtWidgets | |
logger = logging.getLogger(__name__) | |
def refresh(*args): |
import time | |
from zentropi import agent | |
from zentropi.machine import Pin | |
led = Pin(4, mode=Pin.OUT, initial=Pin.LOW) | |
@agent.rate_limit(5) # At most once in 5 seconds | |
@agent.on_event('blink-led') # Run when the event named blink-led is observed |
t followers --csv -l > followers.csv | |
python zero_tweets.py | xargs t block | |
python zero_tweets.py | xargs t delete block |
""" | |
ZMQ with Threaded Workers on Python 3 | |
Python 3 compatible port of: https://gist.github.com/felipecruz/883983 | |
""" | |
import zmq | |
import threading | |
import time | |
from random import choice |
import attr | |
import time | |
import zmq as _zmq | |
from curio import sleep | |
ROUTER = _zmq.ROUTER | |
DEALER = _zmq.DEALER | |
PUB = _zmq.PUB | |
SUB = _zmq.SUB | |
XPUB = _zmq.XPUB |
""" | |
pybble.py | |
Yup, you can run Python on your Pebble too! Go thank the good folks who | |
made Transcrypt, a dead-simple way to take your Python code and translate | |
it to *very* lean Javascript. In our case, instead of browser, we run it | |
on Pebble using their equally dead-simple Online IDE and Pebble.js library. | |
Here's a working example, it runs on a real Pebble Classic. |
import gc | |
import time | |
CLOCK_PERIOD = 0x3fffffff # ACTUAL: overflows at 1073741823 microseconds (1073.74 seconds) | |
# CLOCK_PERIOD = 0x3ffffff # TESTING: overflow at: 67108863 (67.10 seconds) | |
# CLOCK_PERIOD = 0x3fffff # IMPATIENT TESTING: overflow at: 4194303 (4.19 seconds) | |
MAX_TIMEOUT = CLOCK_PERIOD // 2 | |
MAX_SECONDS = MAX_TIMEOUT // (10 ** 6) # 536.87 seconds | |
PLATFORM_ESP = 1 |
export WORKON_HOME=$HOME/virtualenvs | |
export PROJECT_HOME=$HOME/Source | |
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python | |
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv | |
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh | |
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' | |
source /usr/local/bin/virtualenvwrapper_lazy.sh |