Skip to content

Instantly share code, notes, and snippets.

@netaneld122
netaneld122 / Vagrantfile
Last active December 1, 2024 20:48
Vagrantfile for MacOS (arm64) with Ubuntu 24.04 for VirtualBox
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@netaneld122
netaneld122 / patch_bounded_method.py
Created November 5, 2022 09:28
Patch bounded method of pre-existing instance
from unittest.mock import patch
from contextlib import contextmanager
class MyClass:
def print_args(self, *args):
print(f'original: {self=}, {args=}')
@contextmanager
@netaneld122
netaneld122 / moh_safe_qr_code.py
Created February 18, 2021 20:42
How the Israeli Ministry of Health should have generated the "fully vaccinated" certificate QR code
from Crypto.PublicKey import RSA
from Crypto.Signature.pkcs1_15 import PKCS115_SigScheme
from Crypto.Hash import SHA512
import qrcode
import base64
from PIL import Image
from pyzbar import pyzbar