Skip to content

Instantly share code, notes, and snippets.

View inactivist's full-sized avatar
💭
fixing things

Michael Curry inactivist

💭
fixing things
View GitHub Profile
@inactivist
inactivist / scrape_with_logs.py
Created March 15, 2023 11:16 — forked from rengler33/scrape_with_logs.py
How to Capture Network Traffic When Scraping with Selenium & Python
# see rkengler.com for related blog post
# https://www.rkengler.com/how-to-capture-network-traffic-when-scraping-with-selenium-and-python/
import json
import pprint
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
capabilities = DesiredCapabilities.CHROME
@inactivist
inactivist / cmdline.txt
Created December 23, 2020 21:01
Raspberry Pi Raspbian boot settings to support Dragino GPS/LoRA hat
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=xxxxxx rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
@inactivist
inactivist / run_all_test_functs.py
Last active September 29, 2020 01:33
Helper function to find and run all functions prefixed with test_* in current module
def run_all_tests():
# pytest would be nicer
import types
for name, member in globals().items(): # NB: not iteritems()
if isinstance(member, types.FunctionType) and name.startswith("test_"):
print("Run test:", member.__name__)
member()
if __name__ == "__main__":
@inactivist
inactivist / README.md
Last active March 21, 2024 21:58
Create an arq RedisSettings instance from a redis: URI (for example, as used in dokku or similar scenarios)
from collections import defaultdict, OrderedDict
import luigi
from luigi.task import flatten, getpaths
def topological_sorting(struct, outnodes_funct, transform_funct):
struct = flatten(struct.keys()) if isinstance(struct, dict) else flatten(struct)
visited = OrderedDict()
def dvisit(root):
@inactivist
inactivist / luigi_first_steps.md
Created March 22, 2020 13:48 — forked from tomsing1/luigi_first_steps.md
First steps with the Luigi workflow manager

First steps with the Luigi workflow manager

As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.

The problems and solutions described in the examples below have led to the development of sciluigi,

@inactivist
inactivist / luigi_first_steps.md
Last active July 13, 2023 09:12 — forked from tomsing1/luigi_first_steps.md
First steps with the Luigi workflow manager

First steps with the Luigi workflow manager

As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.

The problems and solutions described in the examples below have led to the development of sciluigi,

@inactivist
inactivist / ela.py
Created May 29, 2019 03:29 — forked from cirocosta/ela.py
Error Level Analysis in Python
#!/usr/bin/python
from __future__ import print_function
from PIL import Image, ImageChops, ImageEnhance
import sys, os
import threading
import argparse
parser = argparse.ArgumentParser(description="""
Performs Error Level Analysis over a directory of images
@inactivist
inactivist / mkarchive.sh
Last active May 23, 2019 02:52
Script to generate "daily video" compilation from Zoneminder storage (from: https://forums.zoneminder.com/viewtopic.php?t=24686#p99685)
#!/bin/bash
ZM_MKVID=/path/to/zm_mkvid.py
ZM_MONITORS='Front_Porch_Substream Rear_Porch_Substream'
ZM_EVENTS_DIR=/var/lib/zoneminder/events
NOW_STRING=$( date +%Y%m%d-%H%M%S )
DEST_DIR=/path/to/video_archive
cd ${DEST_DIR}
@inactivist
inactivist / enable-hmr-in-react-360.md
Last active July 17, 2020 18:46
Enable Hot Module Reload (HMR) in React-360

Didn't see this mentioned in docs, so:

To enable HMR:

Append ?hotreload=true to the page URL (assuming this only works in dev mode)

Example:

http://localhost:8081/index.html?hotreload=true