Skip to content

Instantly share code, notes, and snippets.

View andreasgrv's full-sized avatar

Andreas Grivas andreasgrv

View GitHub Profile
andreasgrv / zonotope-hyperplane-intersection.ipynb
Last active March 25, 2022 23:06
Visualisation of zonotope / hyperplane intersection
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
andreasgrv / out.txt
Last active November 28, 2017 13:34
Approximation of samples from a normal by summing samples of uniform.How close to the max value of the Box Muller transform ( clamp at 6.66 standard deviations when using float32) can we get when using a sum of iid uniform samples ?
Got absmax : 2.6663 after 100 iters and 0.00 secs
Got absmax : 2.8621 after 200 iters and 0.00 secs
Got absmax : 3.0409 after 600 iters and 0.00 secs
Got absmax : 3.3918 after 700 iters and 0.00 secs
Got absmax : 3.3950 after 1000 iters and 0.00 secs
Got absmax : 3.6232 after 1100 iters and 0.00 secs
Got absmax : 3.7237 after 2900 iters and 0.01 secs
Got absmax : 3.8769 after 4200 iters and 0.01 secs
Got absmax : 4.0837 after 13400 iters and 0.04 secs
Got absmax : 4.1979 after 71500 iters and 0.17 secs
andreasgrv /
Created May 13, 2016 18:42
Python metaclass experimentation (python 2.7) applied on creating paths
""" experiment on whether we can make a more intuitive interface
for paths by (ab)using metaclasses :D
result :
s = DotPath.myfolder
s = os.path.join('home','user','myfolder')"""
import os
import codecs
andreasgrv /
Created November 19, 2015 11:32
Check which flag is used more to get the version of the command ( -version or --version ). Began this after being totally annoyed that java --version doesn't work.
for command in bash gcc java python perl gunzip unzip less cat vi nano pico ls who find locate rm cp
eval "$command -version" > /dev/null 2>&1
andreasgrv / Makefile
Last active July 7, 2019 19:33
An example of python boost use for a python - C++ interface utilizing python lists as arguments
g++ -Wall -shared -fPIC -o drow.cpp -std=c++0x -lboost_python -I/usr/include/python2.7
andreasgrv /
Created January 19, 2015 07:31
""" module for dataset stuff """
import pandas as pd
def text_counts(filename, label_col):
"""Get counts for how many texts there are for each type of author
:labels: The different classes the data belongs to
:returns: list of numbers of counts
How 'not' to use exception handling.
Well since C++ unlike Java actually lets the programmer figure out how he wants to use exceptions..
Why not exploit the exceptions mechanism and be a bit more creative!?