This file contains 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
#!/usr/bin/env bash | |
set -e | |
# Converts an .epub file to .pdf | |
# Requires Calibre and ghostscript to be installed | |
epubfilename="$1" | |
namenoext="$(basename -- "$epubfilename" .epub)" | |
randomstr="$(basename $(mktemp))" | |
tmpfilename1="$namenoext-$randomstr-1.pdf" | |
tmpfilename2="$namenoext-$randomstr-2.pdf" |
This file contains 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
#!/usr/bin/env python | |
import argparse | |
import os | |
def tree(directory=".", indent = " "): | |
""" | |
Helper function that prints the filesystem tree. | |
""" | |
ignorables = ["__pycache__", ".gitignore", ".DS_Store", ".ipynb_checkpoints", ".git", "venv"] | |
for root, dirs, files in os.walk(directory): |
This file contains 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
#!/usr/bin/env python | |
import argparse | |
import os | |
try: | |
from pdf2image import convert_from_path | |
from PIL import Image | |
except ImportError: | |
print("You need to run `pip install Pillow pdf2image` before this script") | |
import sys | |
sys.exit(-1) |
This file contains 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
% Compile with pdftex, not pdflatex | |
\def\modulo#1#2{(#1-(#1/#2)*#2)} % a mod n = a-(a/n)*n where / is integer division | |
\newcount\X | |
\X=1 | |
\loop | |
\ifnum \numexpr\modulo{\X}{15} = 0 | |
FizzBuzz |
This file contains 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
#!/usr/bin/env python3 | |
""" | |
This script generates links to mybinder and colab online Python environments you | |
can use for any jupyter notebook hosted on in a GitHub repo. | |
Usage: | |
mdnblinks.py --name noBSstatsnotebooks --path "stats_overview/01_DATA.ipynb" | |
Copy paste the output in your README.md to get nice badges for your notebooks. |
This file contains 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
#!/usr/bin/env bash | |
set -e | |
# This script converts any text file into a mp3 audiobook using the MacOS | |
# text-to-speech accessibility command-line tool `say`. | |
# Adjust the `VOICE` and `RATE` parameters to customize to your liking: | |
VOICE="Alex" | |
RATE="295" # pretty fast | |
if [ $# -eq 0 ]; then |
This file contains 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
#!/usr/bin/env python | |
""" | |
Helpers for downloding Kolibri databases and printing topic trees: | |
./kolibridb.py --channel_id=95a52b386f2c485cb97dd60901674a98 | |
or to get the same result as HTML (assuming you have `pandoc` installed): | |
./kolibridb.py --channel_id=95a52b386f2c485cb97dd60901674a98 --htmlexport |
This file contains 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
def retrieve_flex_book_lesson(item): | |
html_url = "/flx/get/perma/modality/lesson/{lesson_id}/{domain_id}?format=html".format( | |
lesson_id=item["handle"], | |
domain_id=item["domain"]["encodedID"], | |
) | |
dst = tempfile.mkdtemp() | |
try: |
This file contains 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
#!/bin/bash | |
### | |
### my-script — does one thing well | |
### | |
### Usage: | |
### my-script <input> <output> | |
### | |
### Options: | |
### <input> Input file to read. | |
### <output> Output file to write. Use '-' for stdout. |
This file contains 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
#!/usr/bin/env python | |
from ricecooker.chefs import SushiChef | |
from ricecooker.classes.nodes import ChannelNode, TopicNode, DocumentNode | |
from ricecooker.classes.files import DocumentFile | |
from ricecooker.classes.licenses import get_license | |
from ricecooker.config import LOGGER | |
NewerOlder