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 / invite.php
Created May 18, 2019 04:26
The actual code used to invite a user to the NoLeave guild.
<?php
/*
This example shows how one would authorize a user with Discord via the oAuth2 flow and request their information
using the token. There are logs to show exactly the information that is generated.
https://discordapp.com/developers/docs/topics/oauth2
*/
require "discord_oauth.php";
@Lachee
Lachee / ValidVariable.js
Created June 5, 2019 05:51
Checks for valid variable names
function(name)
{
return name.match(/^(?!(?:do|if|in|for|let|new|try|var|case|else|enum|eval|null|this|true|void|with|await|break|catch|class|const|false|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$)(?:[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A
@Lachee
Lachee / Recogniser.cs
Created June 9, 2019 13:05
Recognises Rainbow Six: Siege icons.
using ImageMagick;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
namespace SiegeOpDetector
@Lachee
Lachee / compiler.php
Last active August 1, 2019 02:44
XVE Argument Resolve.
<?php
function compileTemplate(Template $template, $tokens)
{
return $template->evaluate($tokens);
}
/**
Resolves a input. Returns either a Literal or a string.
The strings are either a variable name or some compiled code. Either way they are safe to 'paste' in place.
@Lachee
Lachee / ThreadedProcess.cs
Last active August 29, 2019 03:01
A wrapper around a process to provide safe asyncronous
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace AsyncProcess
{
public class ThreadedProcess : IDisposable
@Lachee
Lachee / Bsaic Tab Controller.js
Created September 14, 2019 11:30
Basically controls tabs
class TabController
{
constructor(container)
{
this.domTabs = container;
this.tabs = [];
this._lastIndex = 0;
this.onTabSelected = function(tab){}
@Lachee
Lachee / linkedConns.go
Created October 27, 2019 05:42
A simple linked list for my websocket connections
package main
import (
"github.com/gorilla/websocket"
)
type linkedConns struct {
connection *websocket.Conn
next *linkedConns
}
@Lachee
Lachee / EditorColorLUT.cs
Created February 5, 2020 05:34
Joke Script to include in a shared Unity Project that will slowly make everyone's editor "Play Mode" tint turn to black. Note that a black tint completely obfuscates the editor and makes it impossible to see the play button.
```cs
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class EditorColorLUT : MonoBehaviour
{
private static float decrementation_chance = 0.1f;
private static float decrementation_amount = 0.01f;
@Lachee
Lachee / EditorColorLUT.cs
Created February 5, 2020 05:34
Joke Script to include in a shared Unity Project that will slowly make everyone's editor "Play Mode" tint turn to black. Note that a black tint completely obfuscates the editor and makes it impossible to see the play button.
```cs
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class EditorColorLUT : MonoBehaviour
{
private static float decrementation_chance = 0.1f;
private static float decrementation_amount = 0.01f;
@Lachee
Lachee / HTTP.php
Created April 27, 2020 12:54
HTTP class that provides useful utilities
<?php
namespace kiss\helpers;
use kiss\Kiss;
class HTTP {
const CONTINUE = 100;
const SWITCHING_PROTOCOLS = 101;
const PROCESSING = 102; // RFC2518
const EARLY_HINTS = 103; // RFC8297