Skip to content

Instantly share code, notes, and snippets.

View Flushot's full-sized avatar
👀

Chris Lyon Flushot

👀
View GitHub Profile
@Flushot
Flushot / vimeo_download.py
Last active August 31, 2022 06:24
Vimeo video downloader
#!/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
@Flushot
Flushot / Makefile
Created June 14, 2013 19:50
Makefile for Python virtualenv and pip dependency manifest. Assumes virtual environment will be created in a 'venv' subdirectory.
.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
@Flushot
Flushot / Makefile
Created March 11, 2015 21:32
Python+flask+sqlalchemy microservice boilerplate
.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
LOG_FORMAT = '%(asctime)s %(levelname)-5.5s [%(name)s.%(funcName)s][%(threadName)s] %(message)s'
@Flushot
Flushot / .emacs
Last active May 10, 2021 00:06
Emacs config
;; -*- mode: elisp -*-
;; Chris' emacs file
;; Enable transient mark mode
(transient-mark-mode 1)
;; Enable org-mode
(require 'org)
;; default directory: ~/projects/
@Flushot
Flushot / create_user.sql
Created May 6, 2021 06:29
Postgresql: Create user and database
create user USERNAME with encrypted password 'PASSWORD';
create database DB with owner = USERNAME;
grant all privileges on database DB to USERNAME;
@Flushot
Flushot / postgresql.py
Last active May 6, 2021 05:46
Wrapper for psycopg2 that handles connection pooling, transactions, cursors, and makes the API easier to deal with
"""
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
@Flushot
Flushot / Trie.h
Last active November 5, 2019 23:47
Simple Trie
#ifndef HD_TRIE_H
#define HD_TRIE_H
#include <map>
#include <string>
#include <vector>
/**
* Trie data structure.
*
@Flushot
Flushot / finalcut_lowres_video_transcode.sh
Created June 1, 2019 07:38
Transforms Final Cut Pro master file into lower res MP4
#!/bin/sh
ffmpeg -i $1.mov -vf "scale=iw/2:ih/2" -vcodec libx264 -crf 20 $1.mp4
#!/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