Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Bart barthr

🎯
Focusing
Block or report user

Report or block barthr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@barthr
barthr / .tmux.conf
Created Oct 21, 2018
Tmux con from mac
View .tmux.conf
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
View main.go
package main
import (
"fmt"
"log"
"os"
"sync"
"time"
)
@barthr
barthr / db_scan.py
Created Jan 16, 2018
Dbscan algorithm in python
View db_scan.py
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 Jul 22, 2018
Wrapper for clean handlers in Go
View action.go
package web
import (
"bytes"
"encoding/json"
"io"
"net/http"
)
type errorResponse struct {
View GUI.cs
using System;
namespace GUIapp
{
public abstract class GuiMenuCreator
{
public abstract GuiManager Instantiate(string option, System.Action exit);
}
@barthr
barthr / correlation.go
Last active Jun 10, 2017
Spearman and pearson correlation in Go
View correlation.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 Jun 5, 2017
Backup all your github repositories
View backup.go
package main
import (
"context"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
@barthr
barthr / strrindex.c
Created Jun 4, 2017
Exercise 4.1 from K&R C book
View strrindex.c
#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 Jun 1, 2017
Wordcount with histogram written in C
View wordcount-histogram.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
Merge sort in C
View main.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)
{
You can’t perform that action at this time.