Skip to content

Instantly share code, notes, and snippets.

View Nithanim's full-sized avatar

Nithanim

  • Somewhere with trains
  • Austria
View GitHub Profile
@Nithanim
Nithanim / hybrid_tunnel_locomotive_log.bt
Created August 8, 2021 11:40
File format of hybrid tunnel locomotive log file
//------------------------------------------------
//--- 010 Editor v10.0.2 Binary Template
//
// File: LO_6827.LOG
// Authors:
// Version:
// Purpose: Log file format of something like this hybrid tunnel locomotive: https://www.schoema.de/media/schoema_datenblatt_hybrid-tunnellokomotiven_en.pdf
// Category:
// File Mask:
// ID Bytes:
@Nithanim
Nithanim / start.sh
Created August 7, 2021 18:54
Start script for Guild Wars 2 with a custom wine build
#!/bin/bash
# This is a script for a custom Guild Wars 2 installation on Linux (Ubuntu 20.04).
# Drop it in the wine-prefix folder
# It is the start script for a custom wine build with some (performance) setings on top.
# Options are commented
# A gw2.log will be created right next to this script
path_to_gw2="/path_to_your_gw2_prefix/guild-wars-2/drive_c/Program Files/Guild Wars 2/GW2-64.exe"
@Nithanim
Nithanim / README.md
Created May 9, 2021 22:46
Compile TS3 plugin ducker

How to comple the ducker Teamspeak3 plugin (https://github.com/thorwe/teamspeak-plugin-ducker) for linux.

Mor or less follow the compile instuctions in https://github.com/thorwe/teamspeak-plugin-ducker#compiling-yourself. Since we a are only interested in x64, obly create and go into the build64 folder. the call cto cmake does not need any of the arguments that are stated, only cmake ...

Call make. For the error that complains about random stuff and mentions "fpermissive", go to deps/teamspeak-plugin-qt-common/CMakeLists.txt and add set(CMAKE_CXX_FLAGS "-fpermissive") somewahre in the top lines. Call make again and it should (hopefully) compile successfully.

@Nithanim
Nithanim / README.md
Last active May 14, 2021 13:47
WINE 6.7 staging TKG for Guild Wars 2 on Ubuntu 20.04
@Nithanim
Nithanim / popup.partial.vue.ts
Created May 6, 2021 10:26
OAuth login via popup
// These are some methods from a VUE SFC serving as examples
// Called when user wants to login
private doLogin(provider: AvailableProvider) {
const popup = Login.openPopup();
if (popup == null) {
// Could fall back to full-redirect instead of popup, theoretically
alert("Please allow popups!");
} else {
popup.focus();
@Nithanim
Nithanim / README.md
Last active January 22, 2023 21:05
Passing RX 6800 between host and guest on Ubuntu 20.04

WARNING: unbinding the amdgpu driver does currently NOT work! https://gitlab.freedesktop.org/drm/amd/-/issues/1081

Writeup based on Ubuntu 20.04.2 LTS with xfce and two GPUs from AMD with the amdgpu driver (open source).

Pre-requisites

Pre-requitsite is that you have a basic understanding what are you doing and that you have your IOMMU working.

Ids and devices

@Nithanim
Nithanim / gist:4190b76ca41c38e349dc0430b2e6b8cd
Created December 30, 2020 19:12
Virtualbox: Send shortcuts from host to guest
You might have the circumstance that you have a program sandboxed in a VM in VirtualBox.
But you want to control the program with shortcuts as if it was running on the host.
An example would be voice chat software where you want to toggle the microphone.
You need the HEX values of the keyboard scancodes ("the description of the location on the keyboard", not the character to press!).
Search for "scancode list" on google; e.g. http://www.winfaq.de/faq_html/Content/tip1500/onlinefaq.php?h=tip1576.htm
# send ctrl (left) + shift (left)
VBoxManage controlvm <vmName> keyboardputscancode 1D 2A
# send "m"
@Nithanim
Nithanim / README.md
Last active November 30, 2020 20:02
Using the Java 16 Project Panama JEP 389 Foreign Linker API (Incubator)

Add this to the JVM parameters: --add-modules jdk.incubator.foreign -Dforeign.restricted=permit

@Nithanim
Nithanim / README.md
Created November 28, 2020 15:33
Allow binding a specific program to wireguard for full internet access

This config allows the usage of a dedicated interface from wireguard (or openvpn or whatever) to be used by programs without tunneling all internet traffic to it (default gateway). The program must be able to bind to a specific network interface (the one from wireguard or openvpn). Since only one default route can exist, we use the fact that with iproute2 it is possible to have muliple routing tables where one default route for each table is allowed. The findigns are based on the article here: https://www.thomas-krenn.com/de/wiki/Zwei_Default_Gateways_in_einem_System

Pre-defined (rather "named") tables can be found in /etc/iproute2/rt_tables. This file holds a mapping between the id and the name (separated by whitespace). In commands these names can be used instead of the id but this is not required but might be easier to remember what table is used for what connection. Pretty much any free id can be used. If you look closely when using the wireguard default routing, you can see table 51821 in the output

@Nithanim
Nithanim / client.java
Created November 15, 2020 17:15
Java 11 Http through custom Nginx proxy
@SneakyThrows
public static HttpRequest.Builder applyProxy(HttpRequest.Builder httpRequest, URI proxy) {
URI originalUri = httpRequest.build().uri();
String hostname = originalUri.getHost();
URI proxyUri =
new URI(
"http",
originalUri.getAuthority(),
proxy.getHost(),
proxy.getPort(),