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
| sum_10_condition = ( | |
| ((2, 1), (3, 1)), | |
| ((5, 0), (5, 1)), | |
| ((7, 0), (7, 1)), | |
| ((5, 2), (6, 2)), | |
| ((2, 2), (2, 3)), | |
| ((1, 3), (2, 3)), | |
| ((4, 3), (4, 4)), | |
| ((5, 3), (6, 3)), | |
| ((7, 2), (7, 3)), |
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
| # Check per_utt | |
| with open('per_utt', 'r') as f: | |
| lines = f.read().splitlines() | |
| for i in range(0, len(lines), 4): | |
| ref, hyp, _, _ = lines[i:i+4] | |
| id = ref.split()[0] | |
| ref = ' '.join(ref.split(" ", 1)[1].split()) | |
| hyp = ' '.join(hyp.split(" ", 1)[1].split()) |
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
| from ankipandas import Collection | |
| import pandas as pd | |
| import json | |
| col = Collection("/mnt/c/Users/khoah/AppData/Roaming/Anki2", user="User 1") | |
| col.revs['date'] = col.revs.index | |
| col.revs['seconds'] = (col.revs.index.values/1000).astype(int) | |
| col.revs['times'] = 1 | |
| my_dict = dict() | |
| for s, t in zip(col.revs['seconds'].values, col.revs['times'].values): |
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 encrypt(plaintext, key): | |
| key_length = len(key) | |
| key_as_int = [ord(i) - ord('a') for i in key] | |
| plaintext_int = [ord(i) - ord('a') for i in plaintext] | |
| ciphertext = '' | |
| for i in range(len(plaintext_int)): | |
| value = (plaintext_int[i] + key_as_int[i % key_length]) % 26 | |
| ciphertext += chr(value + ord('a')) | |
| return ciphertext | |
| def decrypt(ciphertext, key): |
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
| N = 10 | |
| S = [0]*256 | |
| T = [0]*256 | |
| K = [10, 20, 25, 15, 40, 60, 30, 70, 75, 90] | |
| P = [1, 2, 2, 2] | |
| C = [] | |
| for i in range(0, 256): | |
| S[i] = i | |
| T[i] = K[i % N] |
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
| p = '111000' | |
| # 19b, 21b, 22b | |
| k = '1100110110101101011011001010110001101110011100010011100011101111'#1100110110101101011. 0110010101100011011100.11100010011100011101111 | |
| x = k[:19] | |
| y = k[19:41] | |
| z = k[41:] | |
| s = '' | |
| # print(x, y, z) |
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 numpy as np | |
| import sys | |
| import PySimpleGUI as sg | |
| # Tutorial: https://www.jigsawacademy.com/blogs/cyber-security/hill-cipher/ | |
| def matrix_cofactor(matrix): | |
| return np.linalg.inv(matrix).T * np.linalg.det(matrix) | |
| def egcd(a, b): |
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
| <script>alert("it's me!")</script> |
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 numpy as np | |
| Allocation = np.array([ [0, 1, 0], | |
| [2, 0, 0], | |
| [3, 0, 2], | |
| [2, 1, 1], | |
| [0, 0, 2]] | |
| ) | |
| Max = np.array([[7, 5, 3], | |
| [3, 2, 2], |
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
| # This file may be used to create an environment using: | |
| # $ conda create --name <env> --file <this file> | |
| # platform: linux-64 | |
| _libgcc_mutex=0.1=main | |
| argon2-cffi=20.1.0=pypi_0 | |
| async-generator=1.10=pypi_0 | |
| attrs=20.3.0=pypi_0 | |
| backcall=0.2.0=pyhd3eb1b0_0 | |
| bleach=3.3.0=pypi_0 | |
| ca-certificates=2021.1.19=h06a4308_0 |
NewerOlder