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
LOG_FORMAT = '%(asctime)s %(levelname)-5.5s [%(name)s.%(funcName)s][%(threadName)s] %(message)s'
@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

Keybase proof

I hereby claim:

  • I am flushot on github.
  • I am flushot (https://keybase.io/flushot) on keybase.
  • I have a public key ASDsNJlQBU8PQkSdKncgPmt6de9uafuQgjd7lzNGmyBHDwo

To claim this, I am signing this object:

@Flushot
Flushot / ascii_graph.sh
Created September 11, 2018 17:44
Convert *.graphml to an ASCII graph
#!/bin/sh
# brew install graphviz cpanminus
# cpanm Graph::Easy
graphml2gv ${1:-/dev/stdin} | graph-easy -
@Flushot
Flushot / pf_block.conf
Created August 21, 2018 23:32
Block IP addresses with macOS/BSD PF firewall
#
# Blocks list of IP addresses using macOS/BSD PF firewall.
#
# Enable: sudo pfctl -ef ./pf_block.conf
#
# Disable: sudo pfctl -d (completely disable firewall)
# sudo pfctl -f /etc/pf.conf (reset rules)
#
blocked_ips = "{ \
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
if (argc < 2) {
fprintf(stderr, "usage: %s [pid]", argv[0]);
return 1;