Skip to content

Instantly share code, notes, and snippets.

@thiagozs
thiagozs / gomock.md
Last active September 5, 2024 11:46
Tutorial gomock

08/16/17 by  Sergey Grebenshchikov

No Comments

This is a quick tutorial on how to test code using the GoMock mocking library and the standard library testing package testing.

GoMock is a mock framework for Go. It enjoys a somewhat official status as part of the github.com/golang organization, integrates well with the built-in testing package, and provides a flexible expectation API.

@loilo
loilo / split-pull-requests.md
Last active August 23, 2024 02:21
Split a large pull request into two
@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
@groovybayo
groovybayo / step-by-step-gatling-idea.md
Last active November 7, 2022 06:47
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
#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;
#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 <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 <iostream>
using namespace std;
enum Color { BLACK, RED };
template <typename T>
class Node_ {
public:
Node_ () { };
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
from itertools import islice
import random
def merge_sort(l):
if len(l) <= 1:
return l
left = []
right = []
middle = len(l) / 2