Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am 83tb on github.
  • I am 83tb (https://keybase.io/83tb) on keybase.
  • I have a public key whose fingerprint is 4CF0 3FE9 9B02 D9AE 32E3 7CA9 9342 B501 E072 B5C5

To claim this, I am signing this object:

@83tb
83tb / msq.py
Created February 1, 2016 21:16
Mosquitto Gist
from nyamuk import nyamuk
from nyamuk import nyamuk_const as NC
the_topic = ""
def on_connect(obj, rc):
if rc == 0:
print "on_connect callback : connection success"
elif rc == 1:
print "Connection refused : unacceptable protocol version"
elif rc == 2:
@83tb
83tb / totalsize.py
Last active August 29, 2015 14:19
Get total size of Python complex objects
from __future__ import print_function
from sys import getsizeof, stderr
from itertools import chain
from collections import deque
try:
from reprlib import repr
except ImportError:
pass
def total_size(o, handlers={}, verbose=False):
@83tb
83tb / meter.py
Created December 1, 2012 20:26
Connecting to sEAB Energy Meter using telnet
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Protocol datasheet: http://bit.ly/TB7Kmn
import telnetlib
HOST = "10.255.1.160"
PORT = "4001"
@83tb
83tb / code_generator.py
Created May 7, 2012 20:37
Simple code generator function in Python. Optionally you can add custom string at the beginning.
import uuid # from http://zesty.ca/python/uuid.html
import sys
import base64
def fetch_code(custom_string="CODE_'):
"""
takes an optional argument, a string to be put at the beginning of a code,
so the code will look like that: