Skip to content

Instantly share code, notes, and snippets.

#include <stdlib.h>
#include <stdio.h>
int compare_int(void* va, void* vb){
int* a = va;
int* b = vb;
return *b - *a;
}
@Highstaker
Highstaker / heapsort.c
Created March 29, 2017 15:39
Generates a list of random integers, makes a heap, and then performs heapsort.
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <assert.h>
// #define ARRAY_SIZE 100
#define MAX_NUMBER 100
#define bool char
@Highstaker
Highstaker / c_lpthreads_example.c
Created February 10, 2018 13:10
An example of threading in C. Shows how one can pass results (via return or pointer argument)
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void* t_routine(void* args){
unsigned int i = 0;
int a;
printf("Running thread!\n");
for(i=0;i<4000000000;i++){
a = 2*2;
@Highstaker
Highstaker / mysql-check.go
Created May 20, 2019 17:41
Just some experiments and attempts to abstract MySQL quering boilerplate away.
package main
import (
"database/sql"
"errors"
"fmt"
"log"
"math/rand"
"runtime"
"strings"