Skip to content

Instantly share code, notes, and snippets.

View cdgriffith's full-sized avatar

Chris Griffith cdgriffith

View GitHub Profile
@cdgriffith
cdgriffith / compare_vmaf_ssim.py
Created July 2, 2020 18:23
Compare a movie via VMAF to a lot of different encoding settings
from subprocess import run, PIPE, STDOUT
from pathlib import Path
from datetime import datetime
import os
movie_file = "video_compare/glass.mp4"
file_name = "glass"
output_directory = "video_compare/ffmpeg"
@cdgriffith
cdgriffith / x265_passthrough.py
Created October 25, 2019 18:26
HDR color primaries and luminance passthrough options
#!/usr/bin/env python
from subprocess import run, PIPE
import re
import sys
import json
su = re.compile(r'",\s*}')
def run_ffprobe(video_file):
@cdgriffith
cdgriffith / keybase.md
Created February 1, 2018 04:03
Keybase Proof

Keybase proof

I hereby claim:

  • I am cdgriffith on github.
  • I am cdgriffith (https://keybase.io/cdgriffith) on keybase.
  • I have a public key ASBaFmoTGd3xUm-9c-oMYpdLjv4qGdCDApkAQaQLgGuHJQo

To claim this, I am signing this object:

@cdgriffith
cdgriffith / transactionParser.js
Last active January 19, 2018 16:31
NiceHash Transaction Parser
/*
Takes a NiceHash mining transaction CSV file and converts it to a monthly average. Ignores non-mining lines.
Requires `csv`
$ npm install csv
Example usage:
$ node transactionParser.js
import reusables
import os
# to be fair, start out at same state for both tests
os.makedirs("folder", exist_ok=True)
@reusables.time_it()
def test_lbyl(remove_folder=False):
@cdgriffith
cdgriffith / eafp_vs_lbyl.py
Created June 22, 2017 22:21
Python EAFP vs LBYL speeds
import reusables
@reusables.time_it()
def test_lbyl(messages):
out = []
for _ in range(10000):
if messages and messages[0] and len(messages[0]) >= 3:
out.append(messages[0][2])
return out
@cdgriffith
cdgriffith / .pythonrc.py
Last active November 21, 2020 04:56
Python RC file
# In .bashrc and .profile
# export PYTHONSTARTUP="$HOME/.pythonrc.py"
# pip install python-box reusables pdir2
from __future__ import print_function, with_statement, absolute_import
try:
from box import Box, BoxList
except ImportError:
print("Box not available")
@cdgriffith
cdgriffith / gen_cert.py
Last active February 22, 2017 19:38
OpenSSL certificate creation
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import logging
from OpenSSL import crypto
log = logging.getLogger("x509_cert")
@cdgriffith
cdgriffith / Makefile
Last active December 15, 2016 22:46
Python deployer makefile (debian only)
HOME ?= $HOME
CWD = $(shell pwd)
VENVS ?= $(HOME)/.virtualenvs
PYTHON2 = $(VENVS)/builder2.7/bin/python2.7
PYTHON3 = $(VENVS)/builder3.5/bin/python3.5
PYTHONS = $(VENVS)/builder2.6/bin/python2.6 $(VENVS)/builder2.7/bin/python2.7 $(VENVS)/builder3.5/bin/python3.5 $(VENVS)/builder3.3/bin/python3.3 $(VENVS)/builder3.4/bin/python3.4
PYPY = $(VENVS)/builderpypy/bin/python
.PHONY: all test clean help register build
@cdgriffith
cdgriffith / factorio_setup.sh
Created June 12, 2016 04:22
Factorio setup
cd /opt
sudo wget https://www.factorio.com/get-download/0.12.35/headless/linux64
sudo tar xzf linux64
sudo groupadd factorio
sudo useradd -g factorio factorio
sudo passwd factorio
sudo chown -R factorio:factorio factorio/
sudo mkdir factorio_data
sudo git clone https://github.com/Bisa/factorio-init.git