Skip to content

Instantly share code, notes, and snippets.

View krzys-h's full-sized avatar

Krzysztof Haładyn (krzys_h) krzys-h

View GitHub Profile
@krzys-h
krzys-h / gist:4277cc84683ae872a22a
Created June 14, 2014 14:27
Java - getting MAC address test program - issue Slowpoke101/FTBLaunch#758
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
public class TestNetworkInterfaces {
public static void main(String[] args) {
boolean returned = false;
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
@krzys-h
krzys-h / SaveRenderTextureToFile.cs
Last active June 24, 2024 06:54
[Unity] Save RenderTexture to image file
using UnityEngine;
using UnityEditor;
public class SaveRenderTextureToFile {
[MenuItem("Assets/Save RenderTexture to file")]
public static void SaveRTToFile()
{
RenderTexture rt = Selection.activeObject as RenderTexture;
RenderTexture.active = rt;
@krzys-h
krzys-h / OpenVRManifest.cs
Last active February 15, 2021 17:34
[Unity] A script to handle creation and registration of OpenVR manifests in a Unity-friendly way
// A script to generate and register an OpenVR manifest in a Unity-friendly way
// OpenVR manifest lets you show proper app name in SteamVR status screen instead of process name, set a custom image for the loading screen in compositor or even allow to launch your game from Steam interface
// Feel free to do anything you want with this script, but please keep this copyright notice intact.
// https://gist.github.com/krzys-h/98464aa2f4a1ad814358f8f078111366
// Author: krzys_h, 2018-02-11
// Usage:
// Put this script anywhere in your assets folder
// Click Edit > Project Settings > OpenVR Manifest
// Fill in the settings
@krzys-h
krzys-h / funpackextractor.py
Created March 4, 2018 10:33
FunPack3D .wfa unpacker
import struct
import os
import sys
PACKAGE_HEADER = "<I"
FILE_HEADER = "<32sII"
print("FunPack 3D .WFA unpacker by krzys_h")
if len(sys.argv) != 2:
print("Usage: {} path_to_file.wfa".format(sys.argv[0]))
@krzys-h
krzys-h / wrapper.c
Last active March 25, 2022 17:48
HTTrack remove param from query string plugin
// Remove sid= from query string plugin for HTTrack
// by krzys_h, 2018-05-15
// https://gist.github.com/krzys-h/4717608089c54f733083fd390e5c0f2b
// This makes HTTrack automatically remove the sid= parameter from URLs it visits, as there is no way this can be done with commandline parameters (see https://forum.httrack.com/readmsg/27508/index.html)
// Compilation and usage:
// gcc -shared -o wrapper.so -fPIC -I/usr/include/httrack wrapper.c
// httrack --wrapper ./wrapper.so ...
@krzys-h
krzys-h / asdf
Last active July 12, 2018 20:53
"ELF executable" in `file -b $1` bypass
#kazet mnie zabije
# 2 sfArk ELF executable
unset LD_TRACE_LOADED_OBJECTS
cat $(find / -iname flag.txt)
# When you run 'file -b asdf' on this, it will print "asdf: sfArk compressed Soundfont Version kazet mnie zabije : ELF executable"
# When you run './asdf', it will execute code
# see https://github.com/markusnussbaum/binaryanalyzer/compare/ee35ecf5c89313df575ad6c6d0109aa0f9b7dc01...fa1eae1f7393c4fb5de57d9a46dadbb674da50cb
@krzys-h
krzys-h / UnityWebRequestAwaiter.cs
Created July 20, 2018 22:47
[Unity] Use UnityWebRequest with async/await
public class UnityWebRequestAwaiter : INotifyCompletion
{
private UnityWebRequestAsyncOperation asyncOp;
private Action continuation;
public UnityWebRequestAwaiter(UnityWebRequestAsyncOperation asyncOp)
{
this.asyncOp = asyncOp;
asyncOp.completed += OnRequestCompleted;
}
@krzys-h
krzys-h / gmserver.py
Last active February 16, 2019 13:32
GameMaker: Studio 1.4 socket protocol
import socketserver
import struct
class GameMakerTCPHandler(socketserver.StreamRequestHandler):
def handle(self):
print("{} trying to connect".format(self.client_address[0]))
self.wfile.write(b"GM:Studio-Connect\0")
r = struct.unpack('IIII', self.rfile.read(16))
if r[0] != 0xcafebabe or r[1] != 0xdeadb00b or r[2] != 16:
raise Exception("Not a GameMaker client")
@krzys-h
krzys-h / deltarune-switch.patch
Last active March 1, 2019 22:36
Deltarune Switch release diff
diff --git a/decomp_normal/gml_Object_DEVICE_CONTACT_Step_0.gml b/decomp_switch/gml_Object_DEVICE_CONTACT_Step_0.gml
index e58927a..9b72f5e 100755
--- a/decomp_normal/gml_Object_DEVICE_CONTACT_Step_0.gml
+++ b/decomp_switch/gml_Object_DEVICE_CONTACT_Step_0.gml
@@ -713,14 +713,20 @@ if (self.EVENT == 67)
{
global.name = self.CHOICE.NAMESTRING
self.FN_2 = global.name
- if (global.lang == "ja")
+ if (self.FN_2 == "GASTER")