Skip to content

Instantly share code, notes, and snippets.

@twam
twam / gist:5213071
Last active December 15, 2015 05:59
Non-uniform distributed random numbers
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
const unsigned int N = 100;
const double MIN = 1;
const double MAX = 10;
const double EXPONENT = 2;
@twam
twam / gist:4972146
Created February 17, 2013 16:39
Create font tables within gnuplot using the example of typical LaTeX fonts
set terminal postscript enhanced eps dashed color "NimbusRomNo9L-Regu" 17 fontfile '/usr/share/texmf-texlive/fonts/type1/public/txfonts/txsy.pfb' fontfile '/usr/share/texmf-texlive/fonts/type1/public/txfonts/rtxmi.pfb'
set xrange [0:1]
set yrange [0:1]
set lmargin 0
set tmargin 0
set bmargin 0
set rmargin 0
unset xtics
unset ytics
@twam
twam / gist:4664907
Last active December 11, 2015 21:48
Another way of accessing arrays ;)
#include <stdio.h>
int main(int arc, char **argv) {
double a[2];
unsigned int i = 1;
a[i] = 1.0;
printf("Value after a[i] = 1.0: %lf\n", a[i]);