Skip to content

Instantly share code, notes, and snippets.

@adamberenzweig
adamberenzweig / freeze_mouse_test.py
Last active October 5, 2023 02:36
freeze_mouse_test.py
import os
import time
from threading import Thread
import HIServices
import Quartz
# Tested on Ventura 13.5.2 with python 3.8.15
_EVENTS = (
from pynput import mouse
def main():
def on_move(x, y):
print('**** on_move', x, y)
def _darwin_intercept(event_type, event):
"""For MacOS support.
The user must grant Accessibility access to Terminal, in the
Security & Privacy > Privacy system preferences.
import time
from pybmi.utils import pynput
kIOHIDAccessTypeDenied = 1
kIOHIDAccessTypeGranted = 0
kIOHIDAccessTypeUnknown = 2
kIOHIDRequestTypeListenEvent = 1
kIOHIDRequestTypePostEvent = 0
@adamberenzweig
adamberenzweig / gist:25d71d97ca7c1510fefd5a662791f576
Created November 10, 2022 20:15
test_DarwinTrackpadListener.py
import Quartz
import time
from AppKit import NSApplication, NSEvent, NSWorkspace
from pynput import _logger
from pynput._util.darwin import ListenerMixin
from pynput._util import AbstractListener, prefix
@adamberenzweig
adamberenzweig / GmailBulkDelete.js
Last active April 28, 2022 13:21
Gmail Bulk Delete and Unsubscribe Script
/*
Gmail bulk delete
Based on:
https://gist.github.com/benbjurstrom/00cdfdb24e39c59c124e812d5effa39a
https://github.com/labnol/unsubscribe-gmail
1. Export gmail Promotions folder via Google takeout: https://takeout.google.com/
2. grep '^From:' Category\ Promotions-001.mbox | cut -d'<' -f2 | tr -d '>' | sort | uniq -c | sort -rn > senders.txt
3. Create a Google Sheets spreadsheet and import senders.txt.

Keybase proof

I hereby claim:

  • I am adamberenzweig on github.
  • I am madadam (https://keybase.io/madadam) on keybase.
  • I have a public key ASBVNIMa_C0GRj8I-GwF1zhZIhP5ZMVZBMHvMqJo4aqh-Ao

To claim this, I am signing this object: