Skip to content

Instantly share code, notes, and snippets.

@tausen
tausen / truthtable-example
Created July 21, 2012 20:44
Simple command-line truth table generator example output
$truthtable "A&(B+C)&~D"
Evaluating: A&(B+C)&~D
A B C D R
0 0 0 0 0
1 0 0 0 0
0 1 0 0 0
1 1 0 0 1
0 0 1 0 0
1 0 1 0 1
@tausen
tausen / quicktest.c
Created May 17, 2012 14:57
AVR GCC UART Tx using interrupts
#define STRLEN 32
#define F_CPU 1843200UL
#define USART_BAUDRATE 115200
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
#include <avr/io.h>
#include <avr/interrupt.h>
#include <string.h>
#include <util/delay.h>
@tausen
tausen / pstcustomshapes.tex
Created April 3, 2012 18:34
Custom pstricks/pst-circ shapes/components
\makeatletter
\def\tor(#1){%
\rput(#1){%
\pnode(0,0){or2}
\pnode([nodesep=0.5,angle=90]or2){or1}
\pnode([nodesep=0.25,angle=90]or2){ormid}
\pnode([nodesep=1]ormid){or3}
\psbezier[showpoints=false]{-}([nodesep=0.25,angle=100]or1)([nodesep=0.25,angle=5]ormid)([nodesep=0.25,angle=-5]ormid)([nodesep=0.25,angle=-100]or2)
\psline([nodesep=0.1]or2)([nodesep=-0.5]or2)
\psline([nodesep=0.1]or1)([nodesep=-0.5]or1)
@tausen
tausen / gist:1547398
Created January 1, 2012 13:58
MATLAB implicit plot
% Credits to Vincent Morio
% http://www.mathworks.com/matlabcentral/newsreader/view_thread/152947
% Limits
xlims = [-5 5];
ylims = [-5 5];
zlims = [-5 5];
steps = 30;
noedge = true;
@tausen
tausen / gist:1547052
Created January 1, 2012 11:18
MATLAB fourier series test
syms n t;
% Set d to the series, using symsum()
d=1+symsum(sin(n/2*t)*(sin(((n+2)*pi)/(2))*4/(pi^2*n^2)+(-1)^n*2/(n*pi)),n,1,100);
% Prep an x-axis
t=linspace(-10,10,1000);
% Evaluate the values accordingly
data=eval(d);
% And plot it
plot(t,data);
@tausen
tausen / gist:1517302
Created December 24, 2011 13:02
MATLAB fancy plotting
%% FANCY PLOTTING %%
% Code by Mathias Tausen, 2011 %
% Contact: mathias.tausen@gmail.com %
% Version: beta 0.5 rev1, 191211 %
%----------------------------------------------------------%
% Eases the process of plotting data with MATLAB %
% %
% How to use: %
% - Specify the data files in the files cell, syntax: %
% files = {'file1';'file2';'file3'}; %