This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def invert(A): | |
| ''' Returns the inverse of A, where A is a square matrix in the form of a nested list of lists. ''' | |
| A = [A[i]+[int(i==j) for j in range(len(A))] for i in range(len(A))] | |
| for i in range(len(A)): | |
| A[i:] = sorted(A[i:], key=lambda r: -abs(r[i])) | |
| A[i] = [A[i][j]/A[i][i] for j in range(len(A)*2)] | |
| A = [[A[j][k] if i==j else A[j][k]-A[i][k]*A[j][i] for k in range(len(A)*2)] for j in range(len(A))] | |
| return [A[i][-len(A):] for i in range(len(A))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| ''' | |
| A graph generator for Rubik's cube times. | |
| This code is a mess. It was never supposed to get this long. I'm sorry. | |
| Copyright (c) 2015 Brendan Gray | |
| Copying and distribution of this file, with or without modification, | |
| are permitted in any medium without royalty provided the copyright | |
| notice and this notice are preserved. This file is offered as-is, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/python3 | |
| """ | |
| Goes through the WCA database, and calculates the KinchRanks for each person. | |
| Copyright (c) 2015 Brendan Gray | |
| Copying and distribution of this file, with or without modification, | |
| are permitted in any medium without royalty provided the copyright | |
| notice and this notice are preserved. This file is offered as-is, | |
| without any warranty. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| ''' | |
| Downloads the images used by http://xkcd.com/1608/ | |
| Copyright (c) 2015 Brendan Gray | |
| Copying and distribution of this file, with or without modification, | |
| is permitted in any medium without royalty provided the copyright | |
| notice and this notice are preserved. This file is offered as-is, | |
| without any warranty. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function out = test | |
| % Testing probabilities for TTLL in ZZ-CT | |
| cs = perms(1:5); | |
| es = perms(1:4); | |
| count = 0; | |
| states = cell2table(cell(0,(9+5))); | |
| states.Properties.VariableNames = {'UBL_1','UBR_2','UFR_3','UFL_4','DFR_5','UB_1','UR_2','UF_3','UL_4','Prob','Solved','PLL','RU2gen','yRU2gen'}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DATE=$(date +"%Y%m%d%H%M") | |
| TITAN_DB=./Databases/Prisma_Titan_$DATE | |
| IAPETUS_DB=./Databases/Prisma_Iapetus_$DATE | |
| ENCALADUS_DB=./Databases/Prisma_Encaladus_$DATE | |
| TITAN_CSV=./CSVDumps/Prisma_Titan.csv | |
| IAPETUS_CSV=./CSVDumps/Prisma_Iapetus.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| ''' | |
| Created on 19 May 2016 | |
| Copyright (c) 2016 Brendan Gray and Sylvermyst Technologies | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import json | |
| import time | |
| def tic(): | |
| tic.start = time.time() | |
| def toc(): | |
| print('Time elapsed:', round(time.time() - tic.start, 3),'s\n') | |
| return (time.time() - tic.start) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Convert all pdfs in a folder into pngs using inkscape | |
| for f in *.pdf | |
| do | |
| echo "Now processing $f" | |
| inkscape --without-gui -f $f --export-png ${f%.*}.png --export-area-page | |
| echo | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @timeit | |
| def calc_averages_naive(times: List[float], window_size: int, cutoff_size: int): | |
| divisor = window_size - (cutoff_size * 2) | |
| averages = [] | |
| for i in range(len(times) - window_size + 1): | |
| window = times[i:i+window_size] | |
| window.sort() | |
| averages.append(sum(window[cutoff_size: -cutoff_size]) / divisor) |
OlderNewer