Skip to content

Instantly share code, notes, and snippets.

View max-hoffman's full-sized avatar

Maximilian Hoffman max-hoffman

View GitHub Profile
@max-hoffman
max-hoffman / switch.sh
Created April 12, 2022 16:40
go version switcher
#!/bin/bash
# switch.sh is used to avoid downloading a new
# version of Golang everytime I want a new version.
#
# Versions are stored in a repo keyed by "go{version}",
# for example "go17" and "go18".
#
# First check that the requested version exists,
# and then delete the old and link the new binary
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
sudo apt-get install python3.7-dev libkrb5-dev gcc
@max-hoffman
max-hoffman / Makefile
Created December 26, 2018 03:23 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@max-hoffman
max-hoffman / centers.py
Created December 12, 2018 23:48
graph centroid API
import numpy as np
import networkx as nx
from functools import wraps
# decorator normalize a selector return array
def normalized(selector):
@wraps(selector)
def normalized_selector(*args, **kwargs):
weights = selector(*args, **kwargs)
return weights / np.sum(weights)