Skip to content

Instantly share code, notes, and snippets.

@mjpieters
mjpieters / touch.js
Last active May 22, 2022 15:16
Touch support for h5ai previews
/*
* Touch support for h5ai previews
*
* Maps left and right swiping gestures on the preview to next and previous controls, double-top to toggling full screen
* Place in the `public/ext` directory, then add `"touch.js"` to the `resources.scripts` list in your `private/conf/options.json` file.
*
* * Copyright: 2022 Martijn Pieters
* * License: The MIT License (MIT)
*/
(function () {
@mjpieters
mjpieters / threading-comments.user.js
Created May 3, 2022 15:13
Threaded comments - recovered copy of Balpha's user script (https://stackapps.com/questions/2050/threaded-comments)
// ==UserScript==
// @name threading-comments
// @namespace stackoverflow
// @description Show threaded comments
// @version 1.1
// @match *://stackoverflow.com/*
// @match *://serverfault.com/*
// @match *://superuser.com/*
// @match *://meta.stackoverflow.com/*
// @match *://meta.serverfault.com/*
from config import ThreadFilter, IgnoreThreadsFilter # noqa: F401
import logging
import threading
import time
# Attach the IgnoreThreadsFilter to the main root log handler
# This is responsible for ignoring all log records originating from
# new threads.
main_handler = logging.FileHandler("/tmp/mainlogfile.log", 'a')
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mjpieters
mjpieters / stacks-palettte-app.json
Last active February 26, 2020 20:52
Stacks palettes plus syntax highlighting color schemes for Stack Overflow, format suitable for https://palettte.app/ import.
[
{
"paletteName": "stacksOrange",
"swatches": [
{
"name": "@orange-900",
"color": "874600"
},
{
"name": "@orange-800",
@mjpieters
mjpieters / # Sourcemap processing in Python.md
Last active December 15, 2023 11:32
Python sourcemap parsing

Sourcemap processing in Python

This gist contains two Python modules:

  • sourcemap: a module to parse and generate JavaScript source maps
  • base64vlq: code to decode and encode base64 VLQ sequences, an encoding used in source maps.

License

The code is licensed under the terms of the MIT license, included in the gist.

Building wheels for collected packages: cryptography
Building wheel for cryptography (PEP 517): started
Building wheel for cryptography (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /opt/python/cp35-cp35m/bin/python /opt/python/cp35-cp35m/lib/python3.5/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp2x0ddkdy
cwd: /tmp/pip-install-t69_d5wd/cryptography
Complete output (138 lines):
running bdist_wheel
running build
running build_py
@mjpieters
mjpieters / # python - 2018-05-06_23-54-46.txt
Created November 8, 2018 13:56
python on macOS 10.13.6 - Homebrew build logs
Homebrew build logs for python on macOS 10.13.6
Build date: 2018-05-06 23:54:46
#!/usr/bin/env python3
import asyncio
import json
import random
import websockets
async def hello(websocket, path):
async for message in websocket:
print(f"< {message}")
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512,SHA1
Date: 2018-07-27
For a number of reasons, I have recently set up a new OpenPGP key,
and will be transitioning away from my old one.
The old key will continue to be valid for some time, but I prefer all
future correspondence to come to the new one. I would also like this