Skip to content

Instantly share code, notes, and snippets.

View honno's full-sized avatar
🛰️

Matthew Barber honno

🛰️
View GitHub Profile
@honno
honno / asda-order-to-csv.py
Last active February 20, 2020 08:34
Get a csv out of asda order summaries
#!/usr/bin/python3
import argparse
import sys
import csv
from bs4 import BeautifulSoup
import requests
if __name__ == "__main__":
#!/usr/bin/env python3
import argparse
import sys
import re
id_pattern= re.compile("[A-Z]+")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
@honno
honno / distribution.csv
Last active March 18, 2020 17:33
Some stats for each ID of dataset
We can't make this file beautiful and searchable because it's too large.
total_freq,pos_freq,neg_freq,KF9.1_miss,KF9.1_present,KF9.1_value,BLOSUM2.1_miss,BLOSUM2.1_present,BLOSUM2.1_value
QVSGSENTDNKPHSE,1,0,1,1,0,?,1,0,?
LQRFDQRSRQFQNLQ,3,0,3,3,0,?,3,0,?
IHFGNDWEDRYYREN,2,2,0,2,0,?,2,0,?
FADLMGYIPLVGAPL,1,1,0,1,0,?,1,0,?
EQEWGTPGSHVREET,1,0,1,0,1,-0.5,1,0,?
NLVGLLGVTGTDLQG,2,2,0,2,0,?,1,1,-0.41
PTDSPSATIDVPSNC,3,0,3,1,2,0.156667,2,1,-0.6
AVGQGWVDHFADGYD,2,1,1,1,1,-0.182667,1,1,0.208
LKLDIQPYDINQRLQ,1,0,1,1,0,?,1,0,?
#!/usr/bin/env python2
from collections import defaultdict
ID_LEN = 5
def gen_primes():
"""Using the Sieve of Erastothenes solution"""
composites = defaultdict(list)
checker = 2
#!/usr/bin/env python2
from collections import defaultdict, deque
from itertools import product
from operator import add
def vectorsum(*vectors):
if len(vectors) > 1:
return map(add, vectors[0], vectorsum(*vectors[1:]))
else:
#!/usr/bin/env python2
from collections import deque
from itertools import permutations
def gen_permutations(numbers, slice_by):
subsequence_len = len(numbers) - slice_by
for permutation in permutations(numbers, subsequence_len):
yield permutation
#!/usr/bin/env python2
from collections import defaultdict
import Queue
DIRECTIONS = [(-1, 0), (0, 1), (1, 0), (0, -1)]
FREE, WALL = 0, 1
class OutOfMapBoundaryError(Exception):
pass
@honno
honno / longest_runs.ipynb
Created June 18, 2020 12:50
Related observations on NIST's longest runs test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@honno
honno / example_profile.py
Last active July 17, 2020 18:25
profiling concept for rngtest
import pandas as pd
from rngtest.profiling import profile, multi_profile
def get_columns(df):
for col in df:
yield df[col]
@profile