Skip to content

Instantly share code, notes, and snippets.

View tkw1536's full-sized avatar
:octocat:
{{ .Status }}

Tom Wiesing tkw1536

:octocat:
{{ .Status }}
View GitHub Profile
@tkw1536
tkw1536 / relativeUrl.js
Last active January 26, 2017 20:03
Resolve a relative URL in client-side JavaScript with jQuery.
/*
Resolves a relative url
@param url Url to resolve
@param base Optional. Base url to use.
@param isDir Optional. If set to true, will return a directory name ending with a slash.
*/
var resolve = function(url, base, isDir){
var resolveWithBase = false;
var baseUrl, oldBase, newBase;
@tkw1536
tkw1536 / loadExternal.js
Last active January 4, 2016 03:39
Loading external JavaScript and CSS files with callback
/*
Loads external javascript files.
@param url Url(s) of script(s) to load.
@param callback Optional. Callback of script to load.
@param scope Optional. Scope of callback.
@param preLoadHack Optional. Function to call before loading a specific file.
*/
var loadExternalJS = function(url, callback, scope, preLoadHack){
var TIMEOUT_CONST = 15000; //timeout for bad links
#!/usr/bin/env ipython
#
# Plots X/Y/T Data from a csv file
# (c) Tom Wiesing 2014
#
from numpy import *
from scipy import *
from pylab import *
@tkw1536
tkw1536 / .htaccess
Created March 11, 2014 20:46
A really quick apache / php proxy script.
Options -Indexes
RewriteEngine on
# Add Slashes
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
# Force a domain - optional
# RewriteCond %{HTTP_HOST} .
@tkw1536
tkw1536 / MatrixDivison.py
Last active August 29, 2015 14:00
Matrix Aware divison
import numpy as np
# matrix-aware division
def mdiv(x, y):
# everything is float
x = 1.0*x
y = 1.0*y
# if y is a matrix, do matrix division
@tkw1536
tkw1536 / git-hub.py
Last active August 29, 2015 14:03
A script that makes sure that all github remotes are ssh.
#!/usr/bin/env python
"""
A script that makes sure that all github remotes are ssh.
Copyright (c) 2014 Tom Wiesing
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@tkw1536
tkw1536 / README.md
Last active August 29, 2015 14:17 — forked from agnoster/README.md
Agnoster Theme - Rendering with default fonts
@tkw1536
tkw1536 / caseclass.py
Created February 8, 2016 11:08
Dependency-less case classes in pure python
class CaseClass(object):
"""
Class that implements all CaseClass methods.
"""
def __init__(self, *cargs, **kcwargs):
"""
Initialises case class parameters
"""

Keybase proof

I hereby claim:

  • I am tkw1536 on github.
  • I am tkw01536 (https://keybase.io/tkw01536) on keybase.
  • I have a public key ASA9m8upNa63mUHQNzqxknhdr13VmdqL49JfZvXIZkQyBQo

To claim this, I am signing this object:

@tkw1536
tkw1536 / transform.py
Created March 15, 2018 12:44
Hack to quickly transform svg path
import re
def translatePath(pth, x, y):
is_x = True
def replacer(c):
nonlocal is_x
s = c.group()
print(is_x)