Skip to content

Instantly share code, notes, and snippets.

@csh
csh / ServerPing.cs
Last active September 15, 2024 18:55
Server ping written in C#, complete with coloured console output.
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using Newtonsoft.Json;
#if DEBUG
using System.Diagnostics;
package ninja.smirking.demo.shutdown;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Level;
import java.util.regex.Pattern;
/**
* @author Connor Spencer Harries
*/
<templateSet group="bukkit/scheduler">
<template name="runTask" value="org.bukkit.Bukkit.getScheduler().runTask($PLUGIN$, () -&gt; {&#10; $END$&#10;});" description="Executes a task using the given Plugin instance" toReformat="true" toShortenFQNames="true">
<variable name="PLUGIN" expression="variableOfType(&quot;org.bukkit.plugin.Plugin&quot;)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_CODE" value="false" />
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>

Keybase proof

I hereby claim:

  • I am csh on github.
  • I am smirkingninja (https://keybase.io/smirkingninja) on keybase.
  • I have a public key whose fingerprint is 9143 EA5D 99AD 1C65 4840 D6B5 5646 5EB4 429C 9AA2

To claim this, I am signing this object:

@csh
csh / Uint24.cs
Created July 18, 2016 13:44
Numeric types C# is lacking.
using System;
public struct Uint24
{
public const uint MaxValue = 0x00FFFFFF;
public const uint MinValue = 0x00000000;
private uint _val;
public void Update(byte[] val)

Keybase proof

I hereby claim:

  • I am csh on github.
  • I am smrkn (https://keybase.io/smrkn) on keybase.
  • I have a public key whose fingerprint is 874D 260D 54F4 DEA1 4C3B C82B FDDB 5D83 DEAB 1B4A

To claim this, I am signing this object:

@csh
csh / keybase.md
Created September 20, 2019 15:23

Keybase proof

I hereby claim:

  • I am csh on github.
  • I am smrkn (https://keybase.io/smrkn) on keybase.
  • I have a public key ASA5d9MOz2Q_zcqpwxapH7wUyhQt9lIjmnyrguIsF2qDyAo

To claim this, I am signing this object:

@csh
csh / base37.rs
Created May 16, 2020 11:42
Base37 encoder/decoder written in Rust
const VALID_NAME_CHARS: [char; 37] = [
'_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
'3', '4', '5', '6', '7', '8', '9'
];
pub fn encode_base37<T: AsRef<str>>(input: T) -> u64 {
let mut combined = input.as_ref().chars().fold(0u64, |acc, c| {
let acc = acc.wrapping_mul(37);
@csh
csh / Replace-GShadeWithReshade.ps1
Created February 6, 2023 16:15
Quick and Dirty Powershell script for replacing GShade with ReShade and keeping the presets and shaders you've come to love.
# Base Path
$gamePath = "C:\Program Files (x86)\SquareEnix\FINAL FANTASY XIV - A Realm Reborn\game"
# GShade
$shaderPath = "C:\Program Files\GShade\gshade-shaders"
$presetPath = "$gamePath\gshade-presets"
#ReShade
$reshadeDownload = "https://reshade.me/downloads/ReShade_Setup_5.6.0_Addon.exe"
$reshadeOutput = "$env:USERPROFILE/Downloads/ReShade_Setup_5.6.0_Addon.exe"