Skip to content

Instantly share code, notes, and snippets.

View PatWie's full-sized avatar
💭
waiting for the end of the AI hype

Patrick Wieschollek PatWie

💭
waiting for the end of the AI hype
View GitHub Profile
@PatWie
PatWie / pattern.sh
Created January 20, 2015 18:57
creates a random checkers pattern and export it to png
WIDTH=300
HEIGHT=300
BGCOLOR="#0f232c"
echo "" > pattern.svg
echo -n "<svg id=\"subtle\" width=\"${WIDTH}\" height=\"${HEIGHT}\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">" >> pattern.svg
echo -n "<rect x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" fill=\"${BGCOLOR}\"></rect>" >> pattern.svg
@PatWie
PatWie / README.md
Last active August 29, 2015 14:15
simple d3js binding for animaitions

To make animation in d3js you usually have an interplay between multiple attributes of objects. This simple solution should simplify the process of animation. You just connect a value

var bindIncrease = new d3binding();
    bindIncrease.ease = "elastic"
    bindIncrease.duration = 2000
    bindIncrease.connect(line, "x2", function(v) {return 100 + v;});
    bindIncrease.connect(dot_center, "cx", function(v) {return 100 + v;});
    bindIncrease.connect(dot_extra, "cx", function(v) {return 3 * v;});
 bindIncrease.connect(hline, "x2", function(v) {return 3 * v;});
@PatWie
PatWie / logisticRegression
Last active August 29, 2015 14:17
logistic Regression
{"nbformat_minor": 0, "cells": [{"execution_count": 25, "cell_type": "code", "source": "# read data from csv file\ndata = readdlm(\"breast-cancer.csv\", ',');\n# get shape of data \n(m,d) = size(data)\n", "outputs": [{"execution_count": 25, "output_type": "execute_result", "data": {"text/plain": "(263,10)"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 29, "cell_type": "code", "source": "# first half is training set\ny = data[1:int(m/2),1]; \ny[y .== -1] = 0 \nx = data[1:int(m/2),2:end];\nno = sum(x,1)\n# normalize\nx = x./no;\n# augment by one dimension\nx = [ones(int(m/2),1) x]\n\n\n(_,d) = size(x)\n\n# second half is test set\ny_test = data[int(m/2):end,1];\ny_test[y_test .== -1] = 0\nx_test = data[int(m/2):end,2:end];\n# normalize\nx_test = x_test./no;\n# augment by one dimension\nx_test = [ones(size(x_test,1),1) x_test];\n\nprint(size(x))\nprint(size(y))\nprint(size(x_test))\nprint(size(y_test))", "outputs": [{"output_type": "stream", "name": "stdout",
/*
This brute force algorithm was originally written (by me) back in 1998, and has been collecting dust
since then. However, for the purpose of testing Gist on GitHub I decided to rewrite the algorithm
from VB6 to C#, make some improvements and release this fast, compact, non-recursive, brute force
algorithm under the MIT license: http://opensource.org/licenses/MIT
Notes:
- Do a run with testLetters = "0123456789" and testLength = 3, to see what happens
- Remember to keep the callback testCalback as fast as possible
- Tweet some love to @fredrikdev :)
@PatWie
PatWie / latex-hook.sh
Last active September 15, 2015 22:07 — forked from alexnederlof/latex-hook.sh
A hook to build your Latex files after every Git push.
#!/bin/sh
WEBDIR=yourwebdir
WORKSPACE=your/workspace
TEX_FILE_NAME=your_file
echo
echo "**** Pulling changes into Live [Hub's post-update hook]"
echo
@PatWie
PatWie / XJExGv.markdown
Created December 26, 2015 17:49
XJExGv
@PatWie
PatWie / Animation Playground MkII.markdown
Created December 26, 2015 17:49
Animation Playground MkII

Animation Playground MkII

Me playing around animation features with 2 different Canvas on top of each other and with different effects

A Pen by Giacomo Sorbi on CodePen.

License.

@PatWie
PatWie / scopes.txt
Created September 19, 2016 08:13 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@PatWie
PatWie / depgen.py
Created September 21, 2016 18:22 — forked from rcludwick/depgen.py
Python ordering a build list by giving a dictionary of dependencies.
'''
These functions take a dictionary of dependencies in the following way:
depdict = { 'a' : [ 'b', 'c', 'd'],
'b' : [ 'c', 'd'],
'e' : [ 'f', 'g']
}
@PatWie
PatWie / tf_serialze.py
Last active March 19, 2017 06:07
create, save, destroy, load
import tensorflow as tf
# save
dummy = tf.Variable(tf.truncated_normal(shape=[10]), name='dummy')
with tf.Session() as sess:
saver = tf.train.Saver()
sess.run(tf.global_variables_initializer())
expected = sess.run(tf.reduce_sum(dummy))
saver.save(sess, 'model')