Skip to content

Instantly share code, notes, and snippets.

View crackwitz's full-sized avatar

Christoph Rackwitz crackwitz

  • Aachen, Germany
  • 23:02 (UTC +02:00)
View GitHub Profile
import os
import sys
import time
import glob
import hashlib
import binascii
import struct
import base64
# https://en.wikipedia.org/wiki/UUHash
@crackwitz
crackwitz / gist:3fe2553ec144710ae01f
Created November 25, 2014 01:33
temptranscode.cmd
@echo off
:loop
if [%1]==[] goto done
set infile=%1
set outfile="%~dpn1-temp.mp4"
shift
ffmpeg -i %infile% -c:a libvo_aacenc -ac 1 -b:a 16k -r 15 -c:v libx264 -pre:v main -b:v 80k -g 75 %outfile%
#include <iostream>
#include <opencv2/opencv.hpp>
int main(int argc, char **argv)
{
if (argc < 3)
{
std::cout << "./a.out <video file name> <number of frames>" << std::endl;
return 0;
}
@crackwitz
crackwitz / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@crackwitz
crackwitz / python_resources.md
Last active August 29, 2015 14:11 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@crackwitz
crackwitz / javascript_resources.md
Last active August 29, 2015 14:11 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
alphabet = {
' ': ' ',
'A': '.-',
'B': '-...',
'C': '-.-.',
'D': '-..',
'E': '.',
'F': '..-.',
'G': '--.',
'H': '....',
import pprint; pp = pprint.pprint
def encode(s, words=None):
if words is None:
words = sorted(set(s))
seq = []
while s:
@crackwitz
crackwitz / colorcorrect.py
Created June 7, 2015 23:06
Premiere's color correction is shit. Try this!
from __future__ import division
import os
import sys
import cv2
import numpy as np
imrgb = np.float32(cv2.imread(sys.argv[1])) / 255.0
imyuv = cv2.cvtColor(imrgb, cv2.cv.CV_BGR2YCrCb)
imyuv[:,:,(1,2)] -= 0.5
l = 274.304 mm <-> d = 52.500 mm
l = 280.000 mm <-> d = 56.273 mm
l = 320.000 mm <-> d = 79.907 mm
l = 350.000 mm <-> d = 96.324 mm
l = 400.000 mm <-> d = 122.787 mm