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 / 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(),
@Nithanim
Nithanim / simple_jni.h
Created August 28, 2020 19:00
Header file of JNI friendly for Ghidra for JNI C Types. File -> Parse C Code -> "+" -> Parse to Program
struct va_list; // shitty hack
typedef struct va_list *va_list;
typedef int jint;
typedef long long jlong;
typedef signed char jbyte;
typedef unsigned char jboolean;
typedef unsigned short jchar;
typedef short jshort;
@Nithanim
Nithanim / fixes.md
Created July 16, 2020 17:10
Getting the Inkplate 6 development to work on linux

These are only fixes for the encountered errors and problems. Follow the official tutorial until you encounter them!

/bin/xtensa-esp32-elf-g++: no such file or directory

The compiler for ESP32 is not installed. (Why is this not in the turorial???) Basically follow https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/. You can have both "Additional Boards Manager URLs" by concatening them with "," like: https://dl.espressif.com/dl/package_esp32_index.json,https://raw.githubusercontent.com/e-radionicacom/Croduino-Board-Definitions-for-Arduino-IDE/master/package_Croduino_Boards_index.json Install the package "esp32" by "Espressif Systems.

@Nithanim
Nithanim / dl_twitch_chat.sh
Created December 26, 2019 18:49
Download twitch broadcasts with youtube-dl including chat with help of PetterKraabol/Twitch-Chat-Downloader
#!/bin/bash
# This file is in the same folder as the other file below. Is called by youtube-dl after the download as "processor".
# We get the filename as parameter and extract the video id from it. Then we pass it to "tcd", the chat downloader.
# Finally, we change the filename of the downloaded chat to match the filename of the downloaded video.
filename="$1"
id=$(echo "$filename" | sed -En 's/v([0-9]+)-.*/\1/p')
tcd --format irc --video "$id"
mv "${id}.log" "${filename%.*}.chat"