Skip to content

Instantly share code, notes, and snippets.

View komodoooo's full-sized avatar
♾️
Learning

komodo komodoooo

♾️
Learning
View GitHub Profile
@komodoooo
komodoooo / fernet.py
Created September 20, 2022 18:32
Just a simple fernet implementation
import base64, sys
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
key = bytes(sys.argv[4], encoding="utf-8")
kdf = PBKDF2HMAC(algorithm=hashes.SHA256(), length=32,salt=b'\xd8Y\x1c\xfb\xc0',iterations=2)
kys = base64.urlsafe_b64encode(kdf.derive(key))
f = Fernet(kys)
def encrypt(text): print(f.encrypt(bytes(text, encoding="utf-8")))
def decrypt(text): print(f.decrypt(bytes(text, encoding="utf-8")))
@komodoooo
komodoooo / pipewire.sh
Last active December 12, 2022 19:20
Script to configure pipewire audio server on arch based systems
sudo pacman -Syu
sudo pacman -S pipewire pipewire-pulse pavucontrol
echo -e "/usr/bin/pipewire &\n/usr/bin/pipewire-pulse &\n/usr/bin/pipewire-media-session &\n$(cat ~/.xinitrc)" >> ~/.xinitrc
echo "Ready to reboot."