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 | |
# Run: pip install argparse requests tqdm | |
# Requires 'ffmpeg' is also installed on your system | |
import os | |
import sys | |
import base64 | |
import tempfile | |
import subprocess | |
import io | |
import shutil |
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
.PHONY: init_venv deps freeze clean_venv | |
all: init_venv deps | |
PYTHONPATH=venv ; . venv/bin/activate | |
init_venv: | |
if [ ! -e "venv/bin/activate_this.py" ] ; then PYTHONPATH=venv ; virtualenv --clear venv ; fi | |
deps: | |
PYTHONPATH=venv ; . venv/bin/activate && venv/bin/pip install -U -r requirements.txt && if [ "$(ls requirements)" ] ; then venv/bin/pip install -U -r requirements/* ; fi |
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
.PHONY: deps | |
all: deps | |
PYTHONPATH=.venv ; . .venv/bin/activate | |
.venv: | |
if [ ! -e ".venv/bin/activate_this.py" ] ; then virtualenv --clear .venv ; fi | |
deps: .venv | |
PYTHONPATH=.venv ; . .venv/bin/activate && .venv/bin/pip install -U -r requirements.txt |
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
LOG_FORMAT = '%(asctime)s %(levelname)-5.5s [%(name)s.%(funcName)s][%(threadName)s] %(message)s' |
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
;; -*- mode: elisp -*- | |
;; Chris' emacs file | |
;; Enable transient mark mode | |
(transient-mark-mode 1) | |
;; Enable org-mode | |
(require 'org) | |
;; default directory: ~/projects/ |
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
create user USERNAME with encrypted password 'PASSWORD'; | |
create database DB with owner = USERNAME; | |
grant all privileges on database DB to USERNAME; |
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
""" | |
PostgreSQL database utilities. | |
Wrapper for psycopg2 that handles connection pooling, transactions, cursors, and makes the API | |
easier to deal with. | |
""" | |
from collections import defaultdict | |
import contextlib | |
import logging | |
import re |
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
#ifndef HD_TRIE_H | |
#define HD_TRIE_H | |
#include <map> | |
#include <string> | |
#include <vector> | |
/** | |
* Trie data structure. | |
* |
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/sh | |
ffmpeg -i $1.mov -vf "scale=iw/2:ih/2" -vcodec libx264 -crf 20 $1.mp4 |
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/sh | |
set -e | |
openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:4096 | |
openssl rsa -pubout -in private.pem -out public.pem |
NewerOlder