Skip to content

Instantly share code, notes, and snippets.

View birjj's full-sized avatar

Johan Fagerberg birjj

View GitHub Profile
@birjj
birjj / DataGenerator.java
Created April 4, 2018 09:25
Data generator
package data_generator;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
@birjj
birjj / source_engine_ropes.md
Last active September 27, 2018 17:41
How the Source engine simulates rope

How the Source engine simulates rope

approximate measurements of rope in the Source engine are available here
this will look at non-solid ropes that aren't affected by wind
a JS implementation is available

Ropes in the Source engine span from a move_rope to a keyframe_rope (or from a keyframe_rope to a keyframe_rope). In both cases two values are relevant for the rope simulation: slack and subdivision.

Slack indicates how low the rope hangs. It is simply a scalar value (usually in the range of a few hundred) that is added to the length of the rope when it is initialized [1].

// ==UserScript==
// @name /r/EU4 styles
// @namespace https://github.com/birjolaxew/r-EU4-styles
// @version 1.0
// @description Add custom CSS style to /r/EU4
// @author birjolaxew
// @match https://www.reddit.com/r/eu4/*
// @run-at document-body
// @grant none
// ==/UserScript==
@birjj
birjj / _ipv4-cidr.js
Last active February 2, 2023 16:25
CIDR helpers for our Azure DevOps wiki
/** Class that represents an IPv4 CIDR range (or a single IP, i.e. a CIDR range with /32 mask) */
class IPv4CIDR {
ip = 0n;
mask = 0n;
constructor(ip, mask = 32) {
this.mask = ~BigInt("0b"+([...new Array(32 - mask)].fill("1").join("") || "0"));
this.ip = BigInt("0b"+(ip.split(".").map((v,i) => (+v).toString(2).padStart(8, "0")).join("")));
}
get start() { return this.ip & this.mask; }
@birjj
birjj / merge-kubeconfigs
Last active March 5, 2023 19:44
Merge Windows kubectl config into WSL config
#!/usr/bin/env zsh
# Written for ZSH - if you use another shell, adapt as needed
# Copies the kubectl config from the default Windows location, converts it to a Unix-compatible format,
# merges it with existing configs and saves it to the default Unix location
# copy over the kubeconfig from Windows, replacing Windows paths with WSL paths
WindowsUser='johan'
WindowsConfig=$(cat "/mnt/c/Users/$WindowsUser/.kube/config")
re='(.*?)([A-Z]:\\[a-zA-Z\\ \.]+)(.*)'
@birjj
birjj / calendar.svg
Last active November 12, 2023 13:59
Laser cut models
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@birjj
birjj / dacota_ac1200_wifi_bridge.md
Last active November 17, 2024 10:27
Setting up a Dacota AC1200 router as a WiFi-to-Ethernet bridge

Setting up Dacota AC1200 as a WiFi-to-Ethernet bridge

The Dacota AC1200 is a stupid, cheap and weak WiFi router. I've had it for a while, and had nothing to do use it for. Then I realized that I could screw it to the underside of my desk, configure it to pull the connection down from WiFi and send it out on its ethernet ports, and connect a short ethernet cable to my desktop computer and printer -- et voila, a connection without pulling any long cables across my walls.

This is primarily notes on how to do that so I can remember the setup myself ;)

Configuring the source network

Find a way to access the DHCP server of your source network. Usually this means accessing your source router's web interface and accessing the "DHCP" tab.