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
alias firealarm=$'git checkout main && git commit -a -m \'[draft] fire alarm\' && git push --force --set-upstream origin main' |
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
''' COMPSCI 373 (2021) - University of Auckland | |
ASSIGNMENT ONE - QR Code Detection | |
Simon Shan 441147157 | |
[!] * * * PLEASE NOTE * * * [!] | |
In this code, sobel and mean kernel operations may look weird. | |
They are optimised for speed. | |
For example, instead of [1 0 -1] * [a b c] = [1*a, 0*b, -1*c], | |
it is simply a - c in my representation | |
''' |
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
hex2bin_table = { | |
'0': '0000', | |
'1': '0001', | |
'2': '0010', | |
'3': '0011', | |
'4': '0100', | |
'5': '0101', | |
'6': '0110', | |
'7': '0111', | |
'8': '1000', |
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
letter = { | |
'A': '00', | |
'E': '11', | |
'T': '010', | |
'C': '0110', | |
'L': '0111', | |
'S': '1000', | |
'R': '1011', | |
'O': '10010', | |
'I': '10011', |
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
print(*[num if num%3 and num%5 else 'fizz'*(not num%3) + 'buzz'*(not num%5) for num in range(1,20)]) |
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
filename = 'self_rep#0.py' | |
import os | |
with open(filename, 'r') as file: content = file.readline()*0 + file.read() | |
filename = 'self_rep#%s.py' % (int(filename.split('.')[0].split('#')[1]) + 1) | |
with open(filename, 'w') as file: file.write(f"filename = '{filename}'\n{content}") | |
os.system(f'python3 {filename}') |
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
import hashlib | |
import uuid | |
HASHFILE = 'example.hash' | |
WORDLIST = 'example.dict' | |
def md5(password): | |
return hashlib.md5(password.encode()).hexdigest() | |
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
import hashlib | |
import uuid | |
def sha256(password): | |
return hashlib.sha256(password.encode()).hexdigest() | |
def salt(): | |
return uuid.uuid4().hex | |
def salted_sha256(password, salt = salt()): |
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 [medianImage , maxImage] = SixLiner(dirName , fileType) | |
% SixLiner: does the matlab project in six lines of code | |
% | |
% inputs : dirName = directory of the images | |
% fileType = file extension type of the images | |
% outputs :medianImage = image background | |
% maxImage = images combined on background | |
% | |
% by simon shan |