Skip to content

Instantly share code, notes, and snippets.

View eruvanos's full-sized avatar

Maic Siemering eruvanos

View GitHub Profile
@yamanahlawat
yamanahlawat / upgrade_pyproject.py
Last active June 16, 2025 05:36
Upgrade all packages using uv
"""
Script to automatically update uv.lock and then update pyproject.toml dependencies.
Prerequisites:
1. Python 3.11+ (for tomllib)
2. tomli-w package (`pip install tomli-w`)
3. uv installed and available in PATH
Usage:
Run this script: `python upgrade_pyproject.py`
@acarril
acarril / bootable-win-on-mac.md
Created November 18, 2022 17:49
Create a bootable Windows USB using macOS

For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

After plugging the drive to your machine, identify the name of the USB device using diskutil list, which should return an output like the one below. In my case, the correct disk name is disk2.

// ==UserScript==
// @name CloudFormation 🌈
// @namespace http://tampermonkey.net/
// @version 0.1
// @description blinky blinky
// @author You
// @match https://*.console.aws.amazon.com/*
// @icon https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/whatsapp/326/rainbow_1f308.png
// @grant none
// ==/UserScript==
@happy-monk
happy-monk / example.py
Created October 22, 2021 13:23
Coroutines in Pyglet
import pyglet
from pyglet.graphics import Batch
import tasks
window = pyglet.window.Window()
batch = Batch()
@window.event
@marcogrcr
marcogrcr / sigv4_using_http_client.py
Last active March 10, 2025 19:26
Send request with SigV4 in python using boto3
from boto3.session import Session
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
from botocore.credentials import Credentials
from http.client import HTTPConnection, HTTPSConnection
import json
import os
from urllib.parse import urlparse
def sigv4_request(
@kasteph
kasteph / workshop.md
Last active February 11, 2021 16:52
PyCon Berlin 2019: Poetry Workshop

Package and Dependency Management with Poetry

The Poetry repository can be found here and the website here.

For documentation on the pyproject.toml file specific to Poetry, go here.

The goal of this workshop is to have a pyproject.toml that poetry can use to build your package to a distribution and then publish it to a private repository.

@jerblack
jerblack / Prevent_flask_production_environment_warning.py
Last active May 25, 2025 04:21
Disable ability for Flask to display warning about using a development server in a production environment.
"""
Flask will display a warning everytime you startup your application if you are not using it in behind a separate WSGI server.
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
This was not relevant for my scenario and I wanted the message gone,
so using this method will remove their ability to print that message
@eruvanos
eruvanos / log_util.py
Last active August 30, 2024 10:58
Better log config for Python
"""
Configures a logger to log <=INFO to stdout and >INFO to stderr
"""
import logging
import os
import sys
DEFAULT_FORMAT = '%(asctime)s - %(levelname)s - %(name)s - %(message)s'
NO_TIME_FORMAT = '%(levelname)s - %(name)s - %(message)s'
@butla
butla / wait_for_tcp_port.py
Last active December 8, 2022 19:52
Waiting for a TCP port to start accepting connections (Python >=3.6)
"""
MIT License
Copyright (c) 2017 Michał Bultrowicz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is