Skip to content

Instantly share code, notes, and snippets.

View jrbergen's full-sized avatar

jrbergen

View GitHub Profile
@jrbergen
jrbergen / steering_throttle_stackoverflowquestion.py
Created May 19, 2021 10:37
Steering throttle snippet stackoverflow question
# Refers to https://stackoverflow.com/questions/67591201/iterating-over-a-numpy-array-returns-only-the-last-item/67591403?noredirect=1#comment119478801_67591403
import numpy as np
def case2(samples: int = 50,
time_interval: int = 5,
time_req: float = 5.0,
steering_ampl: int = 900,
throttle_ampl: int = 1050,
@jrbergen
jrbergen / proton_compat_coh2_syncerror.md
Last active July 21, 2024 13:21
Instructions to resolve Company Of Heroes 2 Sync-Error for Proton (Tested on 5.0-10)

Instructions to resolve Company Of Heroes 2 Sync-Error for Proton (Tested on 5.0-10 and 6.3-2)

In support of this comment on Proton's CoH2 issues thread: Company of Heroes 2 (231430) #3875

Based on original solution by @Cytomax55 in the same thread.

Edit Feb 2023: this may also work for CoH3 (the paths are different of course). I haven't tested this for CoH 3 yet and hope either Proton / Relic will make this fix unnecessary. See also @sfxworks's comment.

Instructions for automatic fix with a script by TechT10n

@jrbergen
jrbergen / tqdm_multiproc.py
Last active January 8, 2022 21:16
multiprocessing.pool-like context manager which supports updating a tqdm progress bar from within.
import time
import uuid
from typing import Callable, Optional, Iterable
import psutil
import tqdm
import multiprocessing as mp
class MultiprocessingPoolTQDM:
ALL_COMPLETED_SENTINEL = "__ALLDONE"
@jrbergen
jrbergen / install_ffmpeg.sh
Last active August 22, 2022 18:56
Downloads, compiles & installs FFmpeg + some dependencies (mostly march native + O3)
#!/usr/bin/bash
clear
USRN=$(whoami)
SRCDIRNAME="ffmpeg-sources"
BLDDIRNAME="ffmpeg-build"
SRCDIR="/home/$USRN/opthome/$SRCDIRNAME"
BUILDDIR="/home/$USRN/opthome/$BLDDIRNAME"
NTHREADS="32"
@jrbergen
jrbergen / monitor.py
Last active September 6, 2022 17:23
Script to change monitor config when using 4 specific monitors in a .:. configuration in x11 (terrible code)
"""Badly coded script to change monitor config when using 4 specific monitors in a .:. configuration in x11"""
from __future__ import annotations
import functools
import os
import re
import sys
import subprocess
import time
#!/bin/bash
# Just a simple bash script to automate extracting & moving a required dll to fix multiplayer sync-error issue.
# All credit for the script to TechT10n
# Credit for writing down the steps for this solution goes to jrbergen, who in turn got the solution from Cytomax55.
# More details here: https://gist.github.com/jrbergen/0ce746676c4fbcc2becd6054d1bba2ed
# and here: https://github.com/ValveSoftware/Proton/issues/3875#issuecomment-764191557
# Below is the default Steam library location.
# Change the path for STEAM_ROOT if you do not use the default location for your Steam Library (do NOT include the trailing /)