Skip to content

Instantly share code, notes, and snippets.

View bsdz's full-sized avatar

Blair Azzopardi bsdz

View GitHub Profile
@chimpdude
chimpdude / remarkable1_tablet_get_update_machine_id.py
Last active May 10, 2021 18:20
Generate random machine ids and send to reMarkable update server to find an ID that is approved for a firmware update.
#!/usr/bin/env python3
import time
import uuid
import random
import requests
# This script is tested and working as of September 2020.
# It is only a slightly modified version of leezu's script: https://gist.github.com/leezu/2efb1533d453b70db406b58eb6e3a2af
# leezu gets 99.9% of the credit
@mblondel
mblondel / check_convex.py
Last active January 3, 2025 12:42
A small script to get numerical evidence that a function is convex
# Authors: Mathieu Blondel, Vlad Niculae
# License: BSD 3 clause
import numpy as np
def _gen_pairs(gen, max_iter, max_inner, random_state, verbose):
rng = np.random.RandomState(random_state)
# if tuple, interpret as randn
ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub
@gdamjan
gdamjan / aiohttp-server.py
Last active October 2, 2021 15:29
Example: asyncio and aiohttp, handling longpoll, eventsource and websocket requests with a queue and background workers
from aiohttp import web
from threading import Thread
import asyncio
import time, uuid
loop = asyncio.get_event_loop()
def long_blocking_thing(sleep):
time.sleep(sleep)
return 42
@ncornette
ncornette / ipython_console.py
Last active November 3, 2023 23:28
Gimp plugin for interactive Gimp scripting using IPython
#!/usr/bin/env python
# 1. Save this file in your ~/.gimp-2.8/plug-ins/ directory
# 2. Run gimp from terminal
# 3. Go to Filters/Python-Fu/IPython Console
# 4. Go back to terminal to enjoy interactive Gimp scripting
#
import gimpfu
import gimp
from gimpfu import pdb
@simonw
simonw / gist:7000493
Created October 15, 2013 23:53
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, obj):
if isinstance(obj, datetime.datetime):
return {
"_type": "datetime",
"value": obj.strftime("%s %s" % (