Skip to content

Instantly share code, notes, and snippets.

View timseed's full-sized avatar
😷
Working on QT and Python Ham Radio based projects.

Tim Seed timseed

😷
Working on QT and Python Ham Radio based projects.
View GitHub Profile
# My Python Env here
VENV_NAME?=pe38
VENV_ACTIVATE=. ~/$(VENV_NAME)/bin/activate
PYTHON= ~/${VENV_NAME}/bin/python3
PIP = pip3
# Execute a command and get the output.... THis is very Version specific
# Not needed but useful to know
#
PYSRC = ft8
PYTEST = ft8/test
@timseed
timseed / test_002.py
Created May 12, 2018 03:35
Nose Tests, using a Generator and Classes
from MySimpleModule import MySimpleModule
cls=None
def test_000_init():
global cls
cls=MySimpleModule()
assert cls

Instead of writing my tests scripts one at a time (testing the same type of data here), I am using the built in nose generator method.

from CheckService import CheckService


def test_generator():
 sites=[ "ftp.esat.net",
@timseed
timseed / gist:fcbf1050d54fb295d4bfddeca33f4a2e
Created March 23, 2018 12:57
Load Imges for Keras Multi Class Classification
from glob import glob
from PIL import Image
import numpy as np
def img_data(class_id,filename):
'''
Return an np array of
CLASS_NUMBER
'''

Unicode respresented as HEX stored as a string

def str_to_hex_str(s):
    out=""
    for c in s:
        out+= "{:04x}".format(ord(c))
 return out
def str_to_hex_str(s):
out=""
for c in s:
out+= "{:04x}".format(ord(c))
return out
def hex_str_to_str(hs):
out=""
When using a Venv (when dont I), the first line whould be like this.
#!/usr/bin/env python3
Faker from command line
pip install faker
faker -l en_GB -r=500 profile ssn,birthdate,name,address,job,dob,phone,credit_card,company
import json
import pprint
from collections import defaultdict
nested_dict = lambda: defaultdict(nested_dict)
query=nested_dict()
query['span_near']['clauses']=list()
query['slop']='1'
@timseed
timseed / keras_frame.ipynb
Created July 28, 2017 04:58
Keras Classification example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.