Skip to content

Instantly share code, notes, and snippets.

View edrdo's full-sized avatar

Eduardo R. B. Marques edrdo

View GitHub Profile
@edrdo
edrdo / DaysInMonth.java
Last active February 17, 2018 14:32
Simple pedagogical example for software testing purposes
// Class containing a method to determine the number of days in a month.
// I use it sometimes for pedagogical purposes in software testing/engineering courses.
public class DaysInMonth {
/**
* Get number of days in a month.
* @param m Month.
* @param y Year.
* @return Number of days of given month and year.
*/
public static int daysInMonth(int m, int y) {
@edrdo
edrdo / PoissonProcess.java
Last active December 20, 2017 17:10
Poison process simulation
package poisson;
import java.util.Random;
/**
* Simple implementation for poisson process random number generation.
* Check http://github.com/edrdo/PoissonProcess
*
* @author Eduardo R. B. Marques
*
@edrdo
edrdo / memlayout.c
Created May 12, 2017 00:51
Memory Layout in C
/**
Output in a typical compiler / architecture will be:
sizeof(a) = 24
offset(a.f16) = 0
offset(a.f32) = 4
offset(a.f08) = 8
offset(a.f64) = 16
sizeof(b) = 16
offset(b.f64) = 0