Skip to content

Instantly share code, notes, and snippets.

View chrisvoncsefalvay's full-sized avatar
🥼
doing science & still alive ;)

Chris von Csefalvay chrisvoncsefalvay

🥼
doing science & still alive ;)
View GitHub Profile
@chrisvoncsefalvay
chrisvoncsefalvay / example_file.html
Created September 27, 2016 21:29
Insert SVG as <object> in Django
{% load i18n static template_tags %}
<html>
<head>
<title>Hello, world!</title>
</head>
<body>
<h1>This is an SVG, inserted as an object.</h1>
{% svgobject 'images/svg/test.svg' 'test-class-one' 'test-class-two' %}
</body>
@chrisvoncsefalvay
chrisvoncsefalvay / process.py
Created June 25, 2016 05:01
Processing injector for live image analysis
import numpy as np
import imutils
import argparse
import cv2
def analyse_image(frame):
@chrisvoncsefalvay
chrisvoncsefalvay / README.md
Last active June 23, 2016 01:42
OpenCV LiveTemplate goodies

@chrisvoncsefalvay
chrisvoncsefalvay / diffiehellman.py
Created April 27, 2016 19:08
Diffie-Hellman key exchange demo code
import hashlib
import ssl
PRIME_18 = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC
  • Update HISTORY.rst
  • Update version number in my_project/__init__.py
  • Update version number in setup.py
  • Install the package again for local development, but with the new version number:
python setup.py develop
  • Run the tests:
python setup.py test
@chrisvoncsefalvay
chrisvoncsefalvay / CartesianProduct.vba
Created July 23, 2015 12:03
Cartesian Product for Kath
Sub cartesianproduct()
Dim startrange As Range
range1 = Application.InputBox(Prompt:="Please Select First Range", Type:=8)
range2 = Application.InputBox(Prompt:="Please Select Second Range", Type:=8)
Set startrange = Application.InputBox(Prompt:="Please select where you want to put it", Type:=8)
array1 = [range1]
array2 = [range2]
# Commits self on sourcing/execution
# Worth appending to the end of some models...
execution_time <- format(Sys.time(), "%d%H%M%b%Y")
commit_string <- paste("Model family RF-1BB19C-", execution_time, " generated", sep="")
commit_cmd <- paste('git add --all && git commit -m "', commit_string, '" && git push origin master', sep="")
system(commit_cmd)
# Simple little suite for testing
test_stationarity <- function(Ts){
# First, display ACF.
message("Rendering ACF. Does it look like a random walk to you?")
acf(Ts)
# Calculate Ljung-Box
box <- Box.test(Ts, lag = 3, type = "Ljung-Box")
message(sprintf("The Ljung-Box statistic was %f.", box$p.value))
@chrisvoncsefalvay
chrisvoncsefalvay / dragons
Created July 20, 2014 21:37
Here be dragons
#
# HERE BE DRAGONS.
#
# LIKE BADLY USED EXECS, STUPIDLY LONG LAMBDAS AND
# GENERALLY CRUDDY CODE.
#
# YOU'VE BEEN WARNED.
#
# . _///_,
# . / ` ' '>
@chrisvoncsefalvay
chrisvoncsefalvay / Regex
Created May 18, 2014 14:15
Regex validator for GitHub repo addresses
/(https://github.com/|git@github.com:)[a-zA-Z0-9_-]*/[a-zA-Z0-9_-]*.git/