Skip to content

Instantly share code, notes, and snippets.

@WalterSimoncini
WalterSimoncini / imgflip_scraper.py
Created May 11, 2020 20:50
imgflip.com meme scraper
"""
imgflip.com scraper
This script scrapes memes from a category on imgflip.com
(e.g. https://imgflip.com/meme/Bird-Box). As an example,
to scrape the first 10 pages of Bird Box memes run:
python imgflip_scraper.py --source https://imgflip.com/meme/Bird-Box --pages 10
The program outputs the memes as a JSON file with the following format:
@WalterSimoncini
WalterSimoncini / pdftk_snippets.sh
Created June 25, 2018 16:25
Some useful snippets for PDF manipulation
# The following commands will modify the orientation of the PDF file
# Supposing you have a normal PDF these commands will:
pdftk in.pdf cat 1east output out.pdf # Rotate the first PDF page 90 degrees clockwise
pdftk in.pdf cat 1west output out.pdf # Rotate the first PDF page 90 degrees counterclockwise
pdftk in.pdf cat 1south output out.pdf # Rotate the first PDF page 180 dedgrees
# Print a single page or a range of pages to the output file
pdftk in.pdf cat 3-5 output out.pdf # Page range
pdftk in.pdf cat 2 output out.pdf # Single range
func listDirectoryFiles (dir: String, indentationFactor: Int) {
let fileManager = NSFileManager.defaultManager()
var prefix = ""
indentationFactor.times({ prefix.appendContentsOf("\t") })
do {
for file: String in try fileManager.contentsOfDirectoryAtPath(dir) as [String] {
let path = dir.stringByAppendingString("/\(file)")
var isDir = ObjCBool(false)