Skip to content

Instantly share code, notes, and snippets.

View dcolish's full-sized avatar

Dan dcolish

View GitHub Profile
/* Takes a list of int args to sort */
#include <stdio.h>
void swap(int array[], int n, int m) {
int tmp = 0;
tmp = array[n];
array[n] = array[m];
array[m] = tmp;
from itertools import islice
import random
def merge_sort(l):
if len(l) <= 1:
return l
left = []
right = []
middle = len(l) / 2
import random
def insert_sort(l):
for i, item in enumerate(l):
while i > 0 and l[i - 1] > item:
l[i] = l[i - 1]
i -= 1
l[i] = item
#include <iostream>
using namespace std;
enum Color { BLACK, RED };
template <typename T>
class Node_ {
public:
Node_ () { };
#include <pthread.h>
#include <stdio.h>
#include "Python.h"
#define atomic_int_add(ptr, val) __sync_add_and_fetch(&ptr, val)
static PyObject*
int_add(PyObject *self, PyObject *args)
{
#include <pthread.h>
#include <stdio.h>
#define atomic_int_add(ptr, val) __sync_add_and_fetch(&ptr, val)
int counter = 0;
void* worker(void* val){
int i;
#ifdef ATOMIC
#include <Python.h>
#include "structmember.h"
#define atomic_int_add(ptr, val) __sync_add_and_fetch(ptr, val)
typedef struct {
PyObject_HEAD
int number;
} AtomicInt;
@groovybayo
groovybayo / step-by-step-gatling-idea.md
Last active October 19, 2025 16:18
Gatling: Step by step guide to IntelliJ integration

Step by step guide to setting up IDEA to write gatling simulations

Prerequisites:

Have [SBT plugin][sbt-plugin] installed

Begin

  • [Create a new project][create-project] in IDEA ( File > New Project ...)
    • Make sure you select a maven module
@dcolish
dcolish / jdoc.sh
Created February 9, 2013 19:31
Always have the javadocs
#!/bin/bash
if [ $DEBUG ]; then
set -x
fi
set -e
unpackJar() {
echo $1
@loilo
loilo / split-pull-requests.md
Last active June 18, 2025 12:15
Split a large pull request into two