Skip to content

Instantly share code, notes, and snippets.

View patrickleweryharris's full-sized avatar
🤖

Patrick Harris patrickleweryharris

🤖
View GitHub Profile
@patrickleweryharris
patrickleweryharris / top_songs.py
Last active November 17, 2021 01:43
Top Played Songs Playlist Generator for Spotify https://lewery.ca/automation/spotify-top-songs/
#!/usr/bin/env python
import argparse
import spotipy
import spotipy.util as util
"""
top_songs.py
See https://lewery.ca/automation/spotify-top-songs/ for detailed
instructions.
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@patrickleweryharris
patrickleweryharris / docx_to_pdf.applescript
Last active November 13, 2021 22:22
Applescript to automatically export .docx documents to PDF using Pages https://lewery.ca/automation/docx-to-pdf
set _document to theFile
-- Open a docx document in pages and auto export to PDF
tell application "Finder"
set _directory to get container of file _document
set _documentName to name of _document
-- Figure out document name without extension
if _documentName ends with ".docx" then ¬
set _documentName to text 1 thru -6 of _documentName
@patrickleweryharris
patrickleweryharris / attachment-saver.applescript
Last active November 17, 2021 01:43
Automatically save all email attachments in Apple Mail https://lewery.ca/automation/autosave-email-attachments
(*using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule*)
-- Adapted from: http://www.markosx.com/thecocoaquest/automatically-save-attachments-in-mail-app/
-- For usage instructions, see: https://lewery.ca/automation/autosave-email-attachments
set MainFolder to "Dropbox" -- After the current users home dir
set subFolder to "mail"
-- The folder to save the attachments in (must already exist)
@patrickleweryharris
patrickleweryharris / reddit_to_pinboard.py
Created July 29, 2019 00:04
Convert all saved Reddit links to Pinboard bookmarks
#!/usr/bin/env python
"""
Convert all saved Reddit links to Pinboard bookmarks
"""
import os
import argparse
import pinboard
import praw
@patrickleweryharris
patrickleweryharris / top_songs.py
Created July 28, 2019 03:23
Automatically create a Spotify playlist based on your top tracks
#!/usr/bin/env python
import argparse
import spotipy
import spotipy.util as util
"""
top_songs.py
This script requires spotipy: https://github.com/plamere/spotipy
Automates creation of a 'Top Songs' playlist on Spotify.
@patrickleweryharris
patrickleweryharris / video-filer.py
Created July 27, 2019 21:02
Rename TV show video files automatically
#!/usr/bin/env python
import os
import re
import shutil
import argparse
"""
video-filer.py
Files TV shows in the format in the format
'$show$season$episode$garbage.$ext' to
@patrickleweryharris
patrickleweryharris / vf
Created July 26, 2019 02:00
Find a file and open it in vim
#!/bin/bash
# Find and open in vim (if more than one file vim will open each in it's own buffer
find . -iname "$1" -exec vim {} \;
@heroheman
heroheman / ranger-cheatsheet.md
Last active May 3, 2024 00:15
Ranger Cheatsheet

Ranger Cheatsheet

General

Shortcut Description
ranger Start Ranger
Q Quit Ranger
R Reload current directory
? Ranger Manpages / Shortcuts
"""
Delete all saved posts / comments on your reddit account with PRAW.
See: https://lewery.ca/automation/delete-all-saved-reddit-links
Needs Python 3+ and Praw 5.3.0
"""
import argparse
import praw