Skip to content

Instantly share code, notes, and snippets.

View MarkusPfundstein's full-sized avatar

Markus Pfundstein MarkusPfundstein

View GitHub Profile
@MarkusPfundstein
MarkusPfundstein / Versions
Created June 9, 2015 13:49
CUDA Tesla K80 Errors
NVIDIA drivers:
<xy>net@train-k80:~/kaggle$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module 346.59 Tue Mar 31 14:10:31 PDT 2015
GCC version: gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
Theano:
<xy>net@train-k80:~/kaggle$ python -c 'import theano; print theano.__version__'
Using gpu device 0: Tesla K80
0.7.0
alignedTypes good
asyncAPI good
bandwidthTest good
batchCUBLAS good
binomialOptions good
binomialOptions_nvrtc good
BlackScholes good
BlackScholes_nvrtc good
boxFilterNPP good
cdpAdvancedQuicksort good
https://www.youtube.com/watch?v=GquJWqNvEPw
Why does the 3rd world need longer to catch up?
- widespread internet use
- great democratisation of education taking place in the 3rd world (MOOC)
- 35$ notebook, down to 10$ within 2 years
- 3d printing of clothing
- educational system must change -> prices of higher education are way too high. industry must be transformed and equalised.
- cultures must adept as well
@MarkusPfundstein
MarkusPfundstein / beautiful.js
Last active September 4, 2016 15:43
Beautiful ES6
const fs = require('fs');
const head = ([x, ...t]) => x;
const tail = ([x, ...t]) => t;
const compose = (f, ...rest) => (x) =>
rest.length === 1
? head(rest)(f(x))
: compose(head(rest), ...tail(rest))(f(x));
@MarkusPfundstein
MarkusPfundstein / IO.js
Last active September 16, 2016 09:29
eventually correct implementation of IO Monad in JS
class IO extends Monad {
constructor(fn) {
super();
this.__value = fn;
}
static of(fn) {
const io = new IO(() => fn);
Object.freeze(io);
return io;
@MarkusPfundstein
MarkusPfundstein / javascript.js
Last active November 6, 2019 00:01
pattern matching function using ramda
/*
* examples - code for matchC is below
* to test: copy&paste into http://ramdajs.com/repl
*/
function main() {
// its all good if all output lines have true in first tuple ;-)
const m1 = matchC('Hello')
.when('string', a => [true, a.toUpperCase()])
.when('number', a => [false, a])
@MarkusPfundstein
MarkusPfundstein / comp.js
Created October 1, 2016 13:58
(partly) lazy list comprehensions js using ramda and generators
//take((e, a) => e+a*a, when(isEven, xs), when(isOdd, ys))
//take((e, a) => e+a*a, [when(isEven, xs), ys])
const R = require('ramda');
// not lazy
const flatxprod = (x, y) => R.map(R.flatten, R.xprod(x, y));
function * nprod(...args) {
function * rec(accum, xs) {
const tailRec = (f) => (a) => {
let v = f(a)
while (!v.done) {
v = f(v.value)
}
return v.value
}
const done = (v) => ({ value: v, done: true })
const next = (v) => ({ value: v, done: false })
@MarkusPfundstein
MarkusPfundstein / fluent_vs_composition_in_FL.js
Last active February 24, 2017 20:54
fluent_vs_composition_in_FL.js
/*
* According to the applicative functor laws, any applicative functor F must satisfy the composition law:
*
* pure (.) <*> F (+ 2) <*> F (* 2)
* ===
* F (+ 2) <*> (F (* 2) <*> F 3)
*
* Let's see how we can show this with two Applicative Functors. Data.Task from folktale and Fluture.
* Data.Task implements the pre v1.0 spec of fantasy-land, while Fluture is up to date.
*
@MarkusPfundstein
MarkusPfundstein / func.js
Created March 10, 2017 15:05
example of Reader.T(Task) and express
const Task = require('data.task');
const { Reader, Maybe } = require('ramda-fantasy');
const ReaderTask = Reader.T(Task);
const R = require('ramda');
const express = require('express');
const app = express();
const MOCK_DB = {
5 : {