Skip to content

Instantly share code, notes, and snippets.

View traverseda's full-sized avatar

traverseda traverseda

  • Halifax, Nova Scotia, Canada
View GitHub Profile
from sympy import S
from wrapt import ObjectProxy
"""
A class for quickly doing math on percentages,
using bayes theorum.
"""
one = S(1)
"""
A system for storing your junk. Print a label, stick it on a box.
Write down what's in that box.
Boxes have a url, constisting of inventory://{Namespace}:{glyphString}.
For example, 'inventory://traverseda:red-ox-yellow-sheep' for the 200th-ish box
that I tag.
Things that go in the box should be refered to by an NFC tag, a uuid, or just write
@traverseda
traverseda / traverseda_cla.md
Last active January 10, 2018 18:10
Personal CLA

Contributor License Agreement

The following terms are used throughout this agreement:

  • You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
  • Project - is an umbrella term that refers to the "traverseda.uwsgi" project.
  • Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
  • Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with Alex Davies, contributors or maintainers.
  1. Grant of Copyright License.
@traverseda
traverseda / phoneAlarm.py
Created June 7, 2018 14:12
A termux cuckoo clock for android
#!/data/data/com.termux/files/usr/bin/python
import schedule, time, datetime
import os
def alarm():
print(datetime.datetime.now())
os.system("termux-vibrate -d 500 -f")
def hourAlarm():
print(datetime.datetime.now())
@traverseda
traverseda / settings.py
Created June 22, 2018 15:08
12factor/django snippet for configging django via enviroment variables
import environ
root = environ.Path(__file__) - 2
# SECURITY WARNING: don't run with debug turned on in production!
env = environ.Env(DEBUG=(bool, True),) # set default values and casting
environ.Env.read_env() # reading .env file
ALLOWED_HOSTS = ['localhost', *env("ALLOWED_HOSTS", default="").split(",")]
SITE_ROOT = root()
"""A binary serializer inspired by rypc's brine.
"""
#from __future__ import annotations
import typing, collections
from io import BytesIO, BufferedReader
from typing import Union, Tuple, FrozenSet, Generator
from functools import singledispatch
singleTons = Union[bool,None]
immutableTypes = Union[singleTons,int,float,complex,str,bytes,slice,Tuple["immutableTypes", ...],FrozenSet["immutableTypes"]]
from camel import CamelRegistry, Camel
from bs4 import BeautifulSoup
import bs4
html_types = CamelRegistry()
@html_types.dumper(BeautifulSoup, 'xml', version=1)
@html_types.dumper(bs4.element.Tag, 'xml', version=1)
def _dump_tag(tag):
out = dict(
@traverseda
traverseda / download.py
Last active January 26, 2019 21:47
Archive bbcode on sufficient velocity.
import requests, lxml
from lxml.etree import tostring
import lxml.html
import html2text
bbUrl = "https://forums.sufficientvelocity.com/posts/{postId}/quote"
session = requests.Session()
session.headers.update({'User-Agent': 'WithThisRing downloader'})
src
├── build.rs
├── main.rs
└── schema
└── baseComponents.capnp
1 directory, 3 files
#Run using `python catcher.py python asyncServer.py /home/traverseda`
import rpyc, sys, pathlib, os, math
class FileListingService(rpyc.Service,pathlib.PosixPath):
def on_connect(self, conn):
self._conn = conn
sys.stdout = conn.root.stdout
pass
def on_disconnect(self, conn):