Skip to content

Instantly share code, notes, and snippets.

import websocket
import paho.mqtt.client as mqtt
import json
import time
from datetime import datetime
from time import sleep
from loguru import logger
from pathlib import Path
# WebSocket URL to connect to
import asyncio
import ssl
# copied from stackoverflow:
# https://stackoverflow.com/questions/46413879/how-to-create-tcp-proxy-server-with-asyncio
async def pipe(reader, writer):
try:
while not reader.
### Keybase proof
I hereby claim:
* I am joshgordon on github.
* I am joshgordon (https://keybase.io/joshgordon) on keybase.
* I have a public key whose fingerprint is A6B0 E115 D8BA 90F0 01CD 380F B42E FF22 FA44 88AB
To claim this, I am signing this object:
cinst flashplayerplugin
cinst google-chrome-x64
cinst flashplayeractivex
cinst notepadplusplus.install
cinst firefox
cinst git.install
cinst 7zip.install
cinst adobereader
cinst jre8
cinst vlc
#!/usr/bin/env python3
"""
Renames a file passed in on the command line, changing dates in the format mm-dd-yy (or mm.dd.yy, mm_dd_yy, etc.)
to the ISO Standard yyyy-mm-dd, assuming any year greater than 50 is the 20th centruy (19xx), and anything before 50 is
the 21st century. (20xx). Note that this choice was arbitrary, since the fileset I was using only went back to 1983 or so,'
1950 was more than adequate.
"""
import sys
import re
import os
@joshgordon
joshgordon / emacs config.el
Created April 30, 2013 05:16
Current emacs config file as of 2013-04-30
(setq inhibit-splash-screen t)
(setq ispell-program-name "/opt/local/bin/aspell")
(add-to-list 'load-path "~/.emacs.d")
;;(require 'autopair)
;;(autopair-global-mode)
(require 'package)
(add-to-list 'package-archives
'("marmalade" .
@joshgordon
joshgordon / square.py
Created April 2, 2013 16:04
A recursive function for determining square
def square(n):
if (n == 1):
return 1
elif (n < 1):
return 0
else:
return square(n-1) + (2 * n - 1)
@joshgordon
joshgordon / sleep.py
Last active December 13, 2015 20:28
Hacked together python script to calculate sleep times. Based on sleepyti.me.
import time
warning=True
try:
from terminal import *
# This uses the terminal library from:
# http://nadiana.com/python-curses-terminal-controller
# Go download it from there and put it in the same dir as this
# if you want to be fancy!
except:
warning=False