Skip to content

Instantly share code, notes, and snippets.

View cdgriffith's full-sized avatar

Chris Griffith cdgriffith

View GitHub Profile
from Xlib.display import Display
from Xlib import X
from Xlib.ext import record
from Xlib.protocol import rq
import time
disp = None
keysym_map = {
32: "SPACE",
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
import json, sys; json.dump(json.load(open(sys.argv[1])), open(sys.argv[1], "w"), indent=4)
import random
try:
raw_input("Symptoms: ")
except NameError:
input("Symptoms: ")
print("Diagnosis: {0}".format(random.choice(["Pregnant", "Cancer"])))
@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
@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 / 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")
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 / 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
@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: