Skip to content

Instantly share code, notes, and snippets.

View lyvd's full-sized avatar

Vu Duc Ly lyvd

View GitHub Profile
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding
private_key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048,
@lyvd
lyvd / resources.md
Created September 6, 2020 14:31 — forked from muff-in/resources.md
A curated list of Assembly Language / Reversing / Malware Analysis -resources

Assembly Language / Reversing / Malware Analysis -resources

Twitter: Muffin

⭐Assembly Language

def fstring_function():
f'{1 + 2 = }'
>>> dis.dis(fstring_function)
2 0 LOAD_CONST 1 ('1 + 2 = ')
2 LOAD_CONST 2 (3)
4 FORMAT_VALUE 2 (repr)
6 BUILD_STRING 2
8 POP_TOP
>>> dis.dis(walrus_func)
2 0 BUILD_LIST 0
2 LOAD_CONST 1 ((1, 2, 3))
4 LIST_EXTEND 1
6 STORE_FAST 0 (a)
3 8 LOAD_GLOBAL 0 (len)
10 LOAD_FAST 0 (a)
12 CALL_FUNCTION 1
14 DUP_TOP
def walrus_func():
a = [1, 2, 3]
if (n := len(a)) > 10:
print(f"List is too long ({n} elements, expected <= 10)")
s = [10, 20]
for s in range(5):
print(s)
2 0 LOAD_CONST 1 (10)
2 LOAD_CONST 2 (20)
4 BUILD_LIST 2
6 STORE_FAST 0 (s)
3 8 LOAD_GLOBAL 0 (range)
10 LOAD_CONST 3 (5)
12 CALL_FUNCTION 1
14 GET_ITER
>> 16 FOR_ITER 12 (to 30)
2 0 LOAD_CONST 1 (10)
2 LOAD_CONST 2 (20)
4 BUILD_LIST 2
6 STORE_FAST 0 (s)
3 8 LOAD_GLOBAL 0 (range)
10 LOAD_CONST 3 (5)
12 CALL_FUNCTION 1
14 GET_ITER
>> 16 FOR_ITER 16 (to 34)
# Source: https://twitter.com/raymondh/status/1284331532153286656?s=20
s = [10, 20]
for s[0] in range(5):
print(s)
# Result:
[0, 20]
[1, 20]
[2, 20]
[3, 20]
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, ZeroPadding2D
from keras.layers import Activation, Dropout, Flatten, Dense
from keras import backend as K
from keras.callbacks import TensorBoard
import os
from shutil import copyfile
import shutil
import sys