Skip to content

Instantly share code, notes, and snippets.

lorem ipsum dolor
@pr4v33n
pr4v33n / jbk1
Created March 4, 2011 19:53
jbk1
a,b,c,d := c,d,a-c*q,b-d*q
declare 4 temporary variables ta, tb, tc, td
then do
ta = a;
tb = b;
tc = c;
td = d;
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <iomanip>
using namespace std;
void foo(int, int, double, double);
double calculate_CI(int, int, double, double);
@pr4v33n
pr4v33n / exhnd.c
Created March 7, 2011 16:59
Exception handling in C
/* Author: http://twitter.com/jaz303 */
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include <stdlib.h>
#define THROW(str) \
if (exception_count < 0) { \
fprintf(stderr, "unhandled exception '%s' at line %d in %s\n", str, __LINE__, __FILE__); \
/*
* program: naturalmergesort.cpp
* Program is an implementation of a 2-way natural mergesort with the addition,
* that it counts the number of comparisions needed by the merging-process.
*/
#include <iostream>
using namespace std;
@pr4v33n
pr4v33n / crazyman.c
Created March 13, 2011 15:22
crazyman
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char **zoznam;
zoznam = (char**)malloc(10*sizeof(char*));
int i;
for (i = 0; i < 10; i++)
@pr4v33n
pr4v33n / john.c
Created March 15, 2011 15:11
Reading integers
#include <stdio.h>
#include <stdlib.h>
#include <glob.h>
#include <errno.h>
int main(int argc, char *argv[])
{
char pattern[] = "/tmp/*.txt";
glob_t globbuf;
FILE *file;
@pr4v33n
pr4v33n / john.c
Created March 15, 2011 16:56
read integers
struct_jobInfo *parseJobs(struct_jobInfo *numbers) {
char pattern[] = "/.dm/*.*.dm";
glob_t globbuf;
FILE *file;
unsigned int i=0, n=0;
long long unsigned size;
char buffer[256];
size = (sizeof(struct struct_jobInfo) * MAXJOBS);
@pr4v33n
pr4v33n / conorhogan.cpp
Created March 20, 2011 20:13
Pi Approximation
// http://min.us/mvk51zd
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
using namespace std;
double machin(void) {
long double pi_approx = 0.0L, t;
@pr4v33n
pr4v33n / deepblue.java
Created March 24, 2011 05:56
deepblue
/**
* A class that models a combination lock.
*/
public class ComboLock
{