Skip to content

Instantly share code, notes, and snippets.

View mightbesimon's full-sized avatar
😎
excited

Simon mightbesimon

😎
excited
View GitHub Profile
@mightbesimon
mightbesimon / .bash_profile
Created July 26, 2022 01:53
run `$ firealarm` before leaving the building
alias firealarm=$'git checkout main && git commit -a -m \'[draft] fire alarm\' && git push --force --set-upstream origin main'
@mightbesimon
mightbesimon / QR code detection.py
Created July 25, 2021 05:46
QR code detection - Image processing
''' 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
'''
@mightbesimon
mightbesimon / many-time pad.py
Last active May 18, 2020 16:36
Vernam cipher (xor vigenere aka many-time pad)
hex2bin_table = {
'0': '0000',
'1': '0001',
'2': '0010',
'3': '0011',
'4': '0100',
'5': '0101',
'6': '0110',
'7': '0111',
'8': '1000',
@mightbesimon
mightbesimon / huffman.py
Created April 3, 2020 12:41
Huffman character encoding/decoding
letter = {
'A': '00',
'E': '11',
'T': '010',
'C': '0110',
'L': '0111',
'S': '1000',
'R': '1011',
'O': '10010',
'I': '10011',
@mightbesimon
mightbesimon / fizzbuzz.py
Last active November 23, 2022 14:20
fizzbuzz
print(*[num if num%3 and num%5 else 'fizz'*(not num%3) + 'buzz'*(not num%5) for num in range(1,20)])
@mightbesimon
mightbesimon / self_rep#0.py
Created February 25, 2020 22:09
2 self replicating codes, infinitely replicating and speed up * * * use with care * * * will fck the computer up
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}')
@mightbesimon
mightbesimon / hashcrack.py
Created February 25, 2020 09:48
crack a list of 'email:md5hash' from a wordlist of passwords
import hashlib
import uuid
HASHFILE = 'example.hash'
WORDLIST = 'example.dict'
def md5(password):
return hashlib.md5(password.encode()).hexdigest()
@mightbesimon
mightbesimon / salthash.py
Last active April 3, 2020 14:32
salt hash
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()):
@mightbesimon
mightbesimon / SixLiner.m
Created February 21, 2020 07:31
UoA Engineering ENGGEN 131 s2 2019 MATLAB project
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