Skip to content

Instantly share code, notes, and snippets.

View tuxerrante's full-sized avatar
💭
Have you tried turning it off and on again?

Affinito Alessandro tuxerrante

💭
Have you tried turning it off and on again?
View GitHub Profile
@Arbow
Arbow / gist:257036
Created December 15, 2009 15:53
golang prime generator
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "fmt"
// Send the sequence 2, 3, 4, ... to channel 'ch'.
func generate(ch chan int) {
@joninvski
joninvski / bellman.py
Created November 16, 2010 11:31
Bellman ford python implementation
import pdb
"""
The Bellman-Ford algorithm
Graph API:
iter(graph) gives all nodes
iter(graph[u]) gives neighbours of u
graph[u][v] gives weight of edge (u, v)
"""
@icyrhyme
icyrhyme / dinic.cpp
Created July 25, 2012 18:11
simple implementation of Dinic's algorithm for solving maxflow problem
#define MAX 500
class Dinic {
int n, m, head[MAXN], level[MAXN], s, t, work[MAXN];
struct edge {
int v, c, f, nxt;
edge() {}
edge(int v, int c, int f, int nxt): v(v), c(c), f(f), nxt(nxt) {}
} e[MAXM];
bool _bfs() {
static int q[MAXN];
@KartikTalwar
KartikTalwar / Documentation.md
Last active June 25, 2024 10:55
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@danielepolencic
danielepolencic / README.md
Last active May 20, 2024 18:07
Create 3 nodes Kubernetes cluster locally with Vagrant

3 Virtual Machines Kubernetes cluster

Dependencies

You should install VirtualBox and Vagrant before you start.

Creating the cluster

You should create a Vagrantfile in an empty directory with the following content:

# Source: https://gist.github.com/dc4ba562328c1d088047884026371f1f
###########################################################
# Using Knative To Deploy And Manage Serverless Workloads #
###########################################################
######################
# Installing Knative #
######################
# Source: https://gist.github.com/808108069f709572f1bc372c65f6b5c0
###########
# Prepare #
###########
# Option 1:
# Create a Kubernetes cluster
# Install NGINX Ingress
# Install Argo CD