Skip to content

Instantly share code, notes, and snippets.

@dmattera
dmattera / man_page_parser.py
Created January 3, 2023 02:31
man_page_parser.py
import os
def parse_man_file(man_filepath):
with open(man_filepath, "r") as man_file:
lines = man_file.read().split("\n")
formatted_lines = []
for line in lines:
# remove Apple developer comments included on the same line and strip off trailing white space
@dmattera
dmattera / launchctl_man_pages.md
Last active April 17, 2024 01:37
macOS man page entries for launchctl services

This list was auto-generated on macOS 10.15 (Catalina) using a script that did the following:

  1. grabbed the name of all the .plist files located in the 5 folders used by launchctl:
  • ~/Library/LaunchAgents Per-user agents provided by the user.
  • /Library/LaunchAgents Per-user agents provided by the administrator.
  • /Library/LaunchDaemons System wide daemons provided by the administrator.
  • /System/Library/LaunchAgents OS X Per-user agents.
  • /System/Library/LaunchDaemons OS X System wide daemons.
# Resources to be used as redirect destinations.
#
# http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
1x1-transparent.gif image/gif;base64
R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
2x2-transparent.png image/png;base64
iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAC0lEQVQI12NgQAcAABIAAe+JVKQAAAAA
@dmattera
dmattera / vpg.py
Last active November 2, 2018 00:22
vpg.py
import requests
import json
refresh_token = """eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU0MzYz
NTI1MCwianRpIjoiNmIxNzM2MGVkYjE2NDExMzhjZWEwMzZmNWE2OTZkM2EiLCJ1c2VyX2lkIjo5Mjg1Mywid
XNlcm5hbWUiOiJTYWludGRvbm92YW4iLCJpc19zdXBlcnVzZXIiOmZhbHNlLCJpc19zdGFmZiI6ZmFsc2UsIm
1hbmFnZXJfdGVhbXMiOltdLCJhc3Npc3RhbnRfdGVhbXMiOltdfQ.Osi73rAT2sRHVtg3f_9Nn3aqVe0uuUzX
zLTxNefEvrw"""
def main():
@dmattera
dmattera / play_song.py
Last active October 25, 2018 21:27
play_song.py
from objc_util import *
def play_song(my_song_title, my_song_artist):
MPMediaQuery = ObjCClass('MPMediaQuery')
songsQuery = MPMediaQuery.songsQuery()
my_songs = []
for result in songsQuery.valueForKey_('collections'):
for mediaItem in result.valueForKey_('items'):
title = mediaItem.valueForKey_('title')
@dmattera
dmattera / twitch_cookie_sniper.py
Created September 6, 2018 12:00
Delete Twitch "unique_id" cookie to prevent ads playing
@dmattera
dmattera / Oxford_English.txt
Created June 30, 2018 18:54
Finds Oxford English Dictionary words using a set of 9 letters from a "Letters" round of Countdown (https://streamable.com/ap4sz)
This file has been truncated, but you can view the full file.
a
aah
aahed
aahing
aahs
aal
aalii
aaliis
aals
aardvark
@dmattera
dmattera / translista.py
Last active April 8, 2018 19:05
Pythonista translator extension
import appex, console, clipboard
import html, requests
from urllib.parse import quote_plus, urlencode
# translate from the share menu in most apps # (e.g. WhatsApp - like so: https://imgur.com/a/6D5fi) or from the clipboard
# translations come from Google Translate API and require a free API key. https://cloud.google.com/translate/docs/quickstart
# Current working environment
# iOS 11.3
@dmattera
dmattera / lulla.py
Last active April 5, 2018 23:56
lullpy - pythonista script for bedtime
import os, sys, time
from objc_util import *
import webbrowser
### Tested with:
### Pythonista 3.2
### iOS 11.3
### The script performs various functions in order to prepare the device for bedtime:
### - lowers volume
@dmattera
dmattera / soup_prettify2.py
Last active November 24, 2023 04:21
A simple way set custom indentation levels when using BeautifulSoup's soup.prettify()
# Python == 3.6.2
# bs4 == 4.6.0
# The current version of BeautifulSoup's soup.prettify() function only allows for
# an indentation level = to 1 space. This is a simple, reliable way to allow for the use
# of any indentation level you wish.
import requests