Skip to content

Instantly share code, notes, and snippets.

View flaviut's full-sized avatar

Flaviu Tamas flaviut

View GitHub Profile
@flaviut
flaviut / util.py
Created October 8, 2013 00:56
matplotlib python utility functions
from matplotlib.pyplot import *
from numpy import *
__author__ = 'Flaviu Tamas'
def add_trendline(x_data, y_data, axis_, degree=1, color="black", decimals=2):
trendfunc, r2 = trendline(x_data, y_data, degree)
axis_.plot(x_data, trendfunc(x_data), color=color, label=trendfunc_to_latex(trendfunc, decimals))
@flaviut
flaviut / gist:8928215
Last active March 1, 2021 13:23
Sidewinder Precision Pro pinout conversion
http://www.descentbb.net/viewtopic.php?t=14791
USB pin 1 red - GP pin 1 red
USB pin 2 white - GP pin 14 yellow
USB pin 3 green - GP pin 10 green
USB pin 4 black - GP pin 4 black
Short GP pin 2 brown - GP pin 7 blue
ignore white, grey, light blue
@flaviut
flaviut / build.gradle
Last active August 29, 2015 13:56
Gradle showing the issues in java 8. Run with ./gradlew -S to get the full stack trace.
apply plugin: 'scala'
@flaviut
flaviut / ExampleApp.bat
Created February 24, 2014 01:48
An example of how gradle packages its ouptuts
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem exampleapp startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@flaviut
flaviut / gist:9376985
Last active August 29, 2015 13:57
Murmerhash3 Dieharder. My sample size (100s of MB) was quite small, so take that as you will.
#==============================================================================#
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
#==============================================================================#
# test_name |ntup| tsamples |psamples| p-value |Assessment #
#====================|====|==========|========|==========|=====================#
# diehard_birthdays| 0| 100| 100|0.40880874| PASSED #
# diehard_operm5| 0| 1000000| 100|0.72452476| PASSED #
# diehard_rank_32x32| 0| 40000| 100|0.78335969| PASSED #
# diehard_rank_6x8| 0| 100000| 100|0.75337552| PASSED #
# diehard_bitstream| 0| 2097152| 100|0.72333358| PASSED #
@flaviut
flaviut / assignment.nim
Last active August 29, 2015 13:57
A template to allow the use of `:=` for assignment
template `:=`(name: expr, value: expr): stmt {.dirty immediate.} =
var name = value
a := 123
echo a
proc next[R](input: iterator(): R): R =
for v in input:
return v
iterator t: int {.closure.} =
yield 1
t.next
# test.nim(2, 13) Error: type mismatch: got (iterator (): int{.closure.})
rm 'build/1_1/astalgo.c'
rm 'build/1_1/ast.c'
rm 'build/1_1/bitsets.c'
rm 'build/1_1/ccgutils.c'
rm 'build/1_1/cgen.c'
rm 'build/1_1/cgmeth.c'
rm 'build/1_1/commands.c'
rm 'build/1_1/condsyms.c'
rm 'build/1_1/crc.c'
rm 'build/1_1/depends.c'
Data structures for the GC
==========================
search( key, t ) typekey key; patricia t; {
if ( t==NULL ) notfound( key );
else {
while ( !IsData(t) )
t = bit(t->level,key) ? t->right : t->left;
if ( key == t->k ) found( t ); else notfound( key );
}
88ed3dca8a942821e60ad8e1779b271c43cc691d examples/cross_calculator/android/src/com/github/nimrod/crosscalculator
df2eed5ea2f12f186f6c20e84bcd0a7c34167c87 examples/cross_calculator/android/src/com/github/nimrod/crosscalculator/CrossCalculator.java
f792306d8b1db560d0b9c3cd32969a8d9d852c4f examples/cross_calculator/android/src/com/github/nimrod/crosscalculator
22a4b9d0c78d147bb2180fb28a627b1937f6803e examples/cross_calculator/android/src/com/github/nimrod/crosscalculator/CrossCalculator.java
0806063ca0b2c96c1cc9a411b3493669acd89b35 rod/c2nim
789e6ec7f062fd9ef9946b577f3aa3e541703679 rod/c2nim/c2nim.cfg
d4b2fee18847e2c3070b00a4aa4d0c0a2ecafbb2 rod/expandimportc.nim
c1b3ea0f422ec27fa8b1c55c822a8ca4df107a2f rod/hashtest.nim
7a396d0caea6121492b327c1be7e50273b97692c rod/nimrod.ini
6fbdaaddcf0cd9240db3834db95ee4330bfc8355 rod/noprefix2.nim