Skip to content

Instantly share code, notes, and snippets.

View barthr's full-sized avatar
🎯
Focusing

Bart barthr

🎯
Focusing
View GitHub Profile
@barthr
barthr / .tmux.conf
Created October 21, 2018 20:39
Tmux con from mac
set -g default-terminal "screen-256color"
set-window-option -g xterm-keys on
set-window-option -g mode-keys vi
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
# THEME
package main
import (
"fmt"
"log"
"os"
"sync"
"time"
)
@barthr
barthr / db_scan.py
Created January 16, 2018 11:16
Dbscan algorithm in python
import string
import numpy as np
UNCLASSIFIED = 0
OUTLIER = -1
class DBSCAN(object):
def __init__(self, epsilon=1.0, min_samples=10, dist=np.linalg.norm):
@barthr
barthr / action.go
Last active July 22, 2018 16:42
Wrapper for clean handlers in Go
package web
import (
"bytes"
"encoding/json"
"io"
"net/http"
)
type errorResponse struct {
@barthr
barthr / GUI.cs
Created June 25, 2017 13:52
test
using System;
namespace GUIapp
{
public abstract class GuiMenuCreator
{
public abstract GuiManager Instantiate(string option, System.Action exit);
}
@barthr
barthr / correlation.go
Last active March 21, 2023 15:09
Spearman and pearson correlation in Go
package stats
import (
"errors"
"math"
"sort"
)
// Correlator represent the contract for a correlation algorithm
// It contains 2 arguments which represent the datasets where the
@barthr
barthr / backup.go
Created June 5, 2017 19:55
Backup all your github repositories
package main
import (
"context"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
@barthr
barthr / strrindex.c
Created June 4, 2017 14:49
Exercise 4.1 from K&R C book
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int strrindex(char *s, char *t);
int main(void)
{
char items[] = "bartbartbart";
char items2[] = "rt";
@barthr
barthr / wordcount-histogram.c
Last active June 1, 2017 18:25
Wordcount with histogram written in C
#include <stdio.h>
#include <stdlib.h>
#define MAXWORDLEN 20 // Maximum length of a word
#define IN 1 // Inside a word
#define OUT 0 // Outside a word
int main(void)
{
int c;
@barthr
barthr / main.c
Created May 6, 2017 15:45
Merge sort in C
#include <stdio.h>
#include <stdlib.h>
void merge(int *c, int *left, int *right, size_t leftL, size_t rightL)
{
int i = 0;
int j = 0;
int k = 0;
while (i < leftL && j < rightL)
{