This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |