Skip to content

Instantly share code, notes, and snippets.

View maxsei's full-sized avatar

Maximillian Schulte maxsei

View GitHub Profile
package sitemap
import (
"sync/atomic"
"fmt"
"net/http"
"io"
"log"
"sync"
"time"
# How to Dual-Boot Arch Linux on my Lenovo t440 ThinkPad using a USB
## Overview
## From Boot Format to Factory Format
1. Open press **Win+R** to open up **Run**
2. Type **diskpart** and press **Enter**
3. `$ list disk` to list all available drives
4. `$ select disk x` (where X is the disk number of the USB drive) to select the disk to format
5. `$ clean` will wipe the drive selected (may need to run more than once if it fails)
@maxsei
maxsei / dsc-accessing-data-with-pandas-lab-houston-ds-042219
Created April 29, 2019 22:57
fix for dsc-accessing-data-with-pandas-lab-houston-ds-042219
": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Accessing Data within Pandas - Lab"
]
},
{
"cell_type": "markdown",
@maxsei
maxsei / $1
Created September 25, 2019 16:14
$(cat $1)
import argparse
import inspect
def describe(thing):
print(list(filter(lambda x: x[0] != "_", dir(thing))))
def argify(*types):
"""
// from https://stackoverflow.com/questions/11849562/how-to-save-the-output-of-a-console-logobject-to-a-file
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
@maxsei
maxsei / function_chaining.py
Last active July 28, 2021 15:04
Chain functions together by defining the order of operations that are performed on an object. Can allow users to dynamically create functions.
from functools import partial
def add(x, y):
return x + y
def mul(x, y):
return x * y
@maxsei
maxsei / shared_gaussian_integral.py
Created July 28, 2021 14:58
Shared Gaussian Integral. I'm pretty sure this just calculates the KL divergence...
def shared_gaussian_integral(u1, u2, s1, s2, ep=1e-8, max_iter=100):
def f(x):
return (
np.power(s1 * (x - u2), 2)
- np.power(s2 * (x - u1), 2)
+ 2 * np.power(s1 * s2, 2) * np.log(s2 / s1)
)
def df(x):
return 2 * (((s1 ** 2) * (x - u2)) - ((s2 ** 2) * (x - u1)))
@maxsei
maxsei / distributive_boolean.py
Created July 31, 2021 16:08
This python code demonstrates distributive law of boolean logic
# coding: utf-8
from itertools import product
def logic(x, y, z):
"""
(
X OR (y AND z) = (x OR y) AND (x OR z)
AND
X AND (y OR z) = (x AND y) OR (x AND z)
@maxsei
maxsei / rolling_median.go
Created September 6, 2021 21:05
Failed attemptet to calculate rolling median in golang. I tried using a heap. I also tried using a two slices: one representing a sorted index of the current slice and the other representing the actual sorted order with index reference to the sorted index
package main
import (
"fmt"
"math"
"sort"
"strings"
)
func main() {