Skip to content

Instantly share code, notes, and snippets.

View Lachee's full-sized avatar
📖
xkcd.com/1421/

Lake Lachee

📖
xkcd.com/1421/
View GitHub Profile
@Lachee
Lachee / gitlab.php
Created February 1, 2018 09:44
GitLab to Discord Webhook
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
DEFINE("COMMIT_BASED_COLOURS", True);
$json = file_get_contents('php://input');
$action = json_decode($json, true);
@Lachee
Lachee / DebugLogger.cs
Created July 23, 2018 06:15
A logger for Discord RPC C# for use within the Unity3D engine.
class DebugLogger : DiscordRPC.Logging.ILogger
{
public LogLevel Level { get; set; }
public void Info(string message, params object[] args)
{
if (Level != LogLevel.Info) return;
Debug.Log("[DRPC] " + string.Format(message, args));
}
@Lachee
Lachee / NativeDllHandler.cs
Last active August 30, 2018 02:49
Native DLL Handler for Unity3D
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
public class DiscordNativeInstall {
@Lachee
Lachee / Packet.cs
Created November 19, 2018 09:55
C# Dotnet Steam RCON Client
public class Packet
{
public int ID { get; set; }
public string Body { get; set; }
public PacketType Type { get; set; }
public enum PacketType
{
ServerdataAuth = 3,
ServerdataAuthResponse = 2,
ServerdataExecuteCommand = 2,
@Lachee
Lachee / ImageTargetAudioSource.cs
Created December 4, 2018 23:03
Vuforia Audio Source
using UnityEngine;
using Vuforia;
[RequireComponent(typeof(AudioSource))]
public class ImageTargetAudioSource : MonoBehaviour, ITrackableEventHandler
{
[Tooltip("The AudioSource to be activated when the object becomes tracked.")]
public AudioSource audioSource;
private TrackableBehaviour mTrackableBehaviour;
@Lachee
Lachee / ApkInstallRun.cs
Created December 7, 2018 08:09
Will install APK files onto hte android device and then immediately run them
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ApkRun
{
@Lachee
Lachee / Rist.cs
Last active January 30, 2019 05:37
Randomised List
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Lachee.Collections
{
/// <summary>
/// A randomised list. It will store a collection of values with specified weights and provide functionallity to select randomly from the list.
/// </summary>
/// <typeparam name="T">Type to store as the value.</typeparam>
@Lachee
Lachee / NetworkRigidbody2D.cs
Created January 31, 2019 05:01
Conversion of a script I use to use for all my rigidbodies in legacy networking.
using UnityEngine;
namespace Mirror
{
[DisallowMultipleComponent]
[AddComponentMenu("Network/NetworkRigidbody2D")]
[RequireComponent(typeof(Rigidbody2D))]
public class NetworkRigidbody2D : NetworkBehaviour
{
private const int BUFFER_SIZE = 50;
@Lachee
Lachee / NamedPipeClientStream.cs
Created March 27, 2019 10:34
Temporary NamedPipeClientStream fix
using Lachee.IO.Exceptions;
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace Lachee.IO
{
public class NamedPipeClientStream : System.IO.Stream
{
private IntPtr ptr;
@Lachee
Lachee / CertificateFactory.cs
Last active May 1, 2019 00:28
Loads X509 Certificates
using Starwatch.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace Starwatch.API
{
class CertificateFactory