Skip to content

Instantly share code, notes, and snippets.

@ShannonScott
ShannonScott / get_gists.py
Last active July 25, 2019 22:22 — forked from leoloobeek/get_gists.py
[Download Gists] Download all gists for a specific user. #gist #github #forked
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))
@ShannonScott
ShannonScott / youtube_list.py
Last active July 25, 2019 16:42
[Youtube Playlist List Download] Download a YouTube playlist a a list of URLs. #youtube
# Get a YouTube playlist as a list of URLs
#
# Assumes `youtube-dl` is installed
#
# python3 youtube_list.py
import sys
import json
from subprocess import check_output
@ShannonScott
ShannonScott / Amazon MP3 Cart Backup Chrome Bookmark.md
Last active August 9, 2019 22:13
[Amazon MP3 Cart] Format Amazon MP3 cart for easy backup. #amazon

Make a new (empty) Chrome bookmark, and copy the following to the URL field:

javascript:(function(){var output = ""; var mlist = document.getElementsByClassName('MusicCartReviewListFullPage')[0]; for (ii = 0; ii < mlist.children.length; ii += 2) { var item = mlist.children[ii]; try { var entry = item.getElementsByClassName('a-fixed-left-grid-inner')[0]; var img_info = entry.children[0].firstElementChild.firstElementChild; var img_url = img_info.getAttribute('src'); output += img_info.outerHTML; var album_info = entry.children[1]; output += '</br>'; output += album_info.children[0].firstElementChild.outerHTML; output += '</br>'; output += album_info.children[2].firstElementChild.outerHTML; output += '</br>'; output += '</br>'; } catch(err) { alert(err.message); console.log(ii); break; } } document.write(output)})();
@ShannonScott
ShannonScott / readme.md
Last active January 15, 2024 03:42
[Transcode h265] Use ffmpeg to transcode a video to h.265 / hvc1 which will play natively on a Mac (and Linux). #tags: video, python, ffmpeg
@ShannonScott
ShannonScott / draw_text_with_background_opencv.py
Last active July 25, 2019 16:36 — forked from aplz/draw_text_with_background_opencv.py
[OpenCV: draw text with background] #opencv #forked
import cv2 # opencv
import numpy as np
font_scale = 1.5
font = cv2.FONT_HERSHEY_PLAIN
# set the rectangle background to white
rectangle_bgr = (255, 255, 255)
# make a black image
img = np.zeros((500, 500))
@ShannonScott
ShannonScott / plotting-with-Matplotlib.ipynb
Last active July 25, 2019 16:45 — forked from hackjutsu/plotting-with-Matplotlib.ipynb
[Jupyter Notebook Demo 4] This is a #demo for Lepton's support of Jupyter Notebook viewer. #forked #jupyter #python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ShannonScott
ShannonScott / Nature.ipynb
Last active July 25, 2019 17:50 — forked from hackjutsu/Nature.ipynb
[Jupyter Notebook Demo 2] This is a #demo for Lepton's support of Jupyter Notebook viewer. #tags: astronomy, jupyter, python, science, forked
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ShannonScott
ShannonScott / pcgen-on-docker.md
Last active April 1, 2020 15:21
[PCGen on Docker] Run the D&D character generator PCGen on Docker on a Mac. #tags: mac, docker, games, D&D, java
@ShannonScott
ShannonScott / tree_walk.py
Last active July 30, 2019 17:06
[Python Walk File Tree] Walk a file tree in python. #python
import os
basepath = '/path/to/files'
extensions = ('.mp4', '.avi', '.mkv', '.mov')
for (dirpath, dirnames, filenames) in os.walk(basepath):
for filename in filenames:
basename, ext = os.path.splitext(filename)
@ShannonScott
ShannonScott / readme.md
Last active August 2, 2019 16:14
[Mac copy/paste commands on Linux] pbcopy and pbpaste from MacOS on Linux. #tags: linux, mac, bash

Mac-style CLI copy / paste on Linux

alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'

Example usage

Pipe clipboard contents to do_something.bash and copy results back to the clipboard.