Skip to content

Instantly share code, notes, and snippets.

Matthew Barber Honno

View GitHub Profile
@Honno
Honno / longest_runs.ipynb
Created Jun 18, 2020
Related observations on NIST's longest runs test
View longest_runs.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View find_shortest_path_of_mutable_map.py
#!/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
View find_largest_num_div_by_3_from_list_of_digits.py
#!/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
View find_min_knight_moves.py
#!/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:
View get_substring_from_prime_numbers_list.py
#!/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
@Honno
Honno / distribution.csv
Last active Mar 18, 2020
Some stats for each ID of dataset
View distribution.csv
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,?
View get_id_freq.py
#!/usr/bin/env python3
import argparse
import sys
import re
id_pattern= re.compile("[A-Z]+")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
@Honno
Honno / asda-order-to-csv.py
Last active Feb 20, 2020
Get a csv out of asda order summaries
View asda-order-to-csv.py
#!/usr/bin/python3
import argparse
import sys
import csv
from bs4 import BeautifulSoup
import requests
if __name__ == "__main__":
View bandcamp-get-all-album-links-in-discography.py
@Honno
Honno / expert-system.lisp
Last active Aug 5, 2019
An inference engine for an expert system.
View expert-system.lisp
;; Forward & Backward Chaining
;;
;; Use (run *rules *goals) in CLISP to try it out.
;;
;; Written by Matthew Barber <quitesimplymatt@gmail.com> under MIT
;;
;; The MIT License (MIT)
;;
;; Copyright (c) 2019 Matthew Barber
;;
You can’t perform that action at this time.