Skip to content

Instantly share code, notes, and snippets.

@nathan130200
nathan130200 / Xml.cs
Created August 26, 2024 20:41
C# helper methods & types to manage XML Linq Elements in .NET
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.Linq;
namespace Jabber;
public static partial class Xml
@nathan130200
nathan130200 / jid.cpp
Created May 22, 2024 21:38
JID parser & management.
#include "jid.h"
#include "xmpp.h"
#include <sstream>
using namespace std;
Jid::Jid()
{
}
@nathan130200
nathan130200 / Program.cs
Last active November 26, 2023 22:21
Java's UUID implementation in C#
using System.Text;
var sampleInput = "TestUuid/.NET";
var expcetedUUIDStr = "e0198edc-d96b-3d2f-83ee-9a0614f93187";
var uuidInstance = Uuid.FromName(Encoding.UTF8.GetBytes(sampleInput));
var currentUUIDStr = uuidInstance.ToString();
// test readonly array
var buf1 = uuidInstance.ToByteArray();
var buf = uuidInstance.ToByteArray();
@nathan130200
nathan130200 / xcloud_custom.user.js
Created September 13, 2022 18:38
Xcloud on browser - Set game video to fill browser area.
// ==UserScript==
// @name Fill Xcloud Video Screen
// @author FRNathan13
// @match https://www.xbox.com/pt-BR/play/launch/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=xbox.com
// @grant none
// @version 1.0
// ==/UserScript==
(function() {
@nathan130200
nathan130200 / MinecraftUtil.cs
Last active August 5, 2022 13:51
T4 templates for stream I/O + Minecraft stream I/O utilities.
using System.Runtime.CompilerServices;
using System.Text;
namespace CraftDedicatedServer;
public static class Util
{
const int SEGMENT_BITS = 0x7f;
const int CONTINUE_BIT = 0x80;
const int MAX_STRING_LEN = short.MaxValue - 3;
@nathan130200
nathan130200 / steam_depot_xml.js
Created July 20, 2022 23:52
Steam depot to XML
// Use browser devtools on an steam depot from https://steamdb.info/depot/:depot_id
// This will fetch all manifest + basic depot info from webpage and return as function value.
function SteamDepotToXML() {
var manifests = [];
for(let temp of document.querySelectorAll(`tr[data-branch]`).entries()) {
if(!temp.length && !temp[1]) continue;
let node = temp[1];
@nathan130200
nathan130200 / shorts-remover.user.js
Created May 22, 2022 11:52
Remove youtube 'shorts' video type from your feed/subscriptions page.
// ==UserScript==
// @name Shorts Blocker
// @version 0.1
// @description Remove all 'shorts' video kind from youtube feed/subscriptions page.
// @match https://www.youtube.com/feed/subscriptions
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(() => {
@nathan130200
nathan130200 / discord-split-panel.user.js
Last active April 22, 2022 18:29
Discord Split Panel
// ==UserScript==
// @name Discord Channel List Sidebar
// @author FRNathan13
// @description Implement split panel between channel list and chat container in discord app, size is saved when you change position of panel. Powered by jQuery and Split.js
// @version 1.3.2
// @match https://discord.com/channels/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=discord.com
// @grant GM_setValue
// @grant GM_getValue
// @require https://code.jquery.com/jquery-3.6.0.min.js
@nathan130200
nathan130200 / Util.cs
Last active March 27, 2022 12:27
Console variable system like in modern games to C#
public static class Util
{
public static T SafeConvert<T>(object raw, T defaults)
where T : new()
{
try
{
return (T) Convert.ChangeType(raw, Convert.GetTypeCode(defaults));
}
@nathan130200
nathan130200 / _readme.md
Created January 4, 2022 20:35
Workshop orbs prototype based on moira orb's.

Workshop Orbs

Orbs in workshop based on moira orbs.

Import Code:

Official import code: 96QBQ

Controls

Hold INTERACT (default button on PC: F) for some seconds and an orb will spawn in front of player.