Skip to content

Instantly share code, notes, and snippets.

View SilverCory's full-sized avatar
❄️
Serve chilled. Carbonated.

Cory Redmond SilverCory

❄️
Serve chilled. Carbonated.
View GitHub Profile
@SilverCory
SilverCory / firestore_values.go
Created February 22, 2024 12:24
Firestore Value Flattening and unmarshalling
package firestore_type
import "encoding/json"
type Value struct {
Value interface{}
}
func (v *Value) UnmarshalJSON(data []byte) error {
var fsPayload map[string]interface{}
@SilverCory
SilverCory / README.md
Created September 6, 2023 13:24
Golang Gin SPA serving using embedded fs

Golang Gin SPA serving using embedded fs.

Usage:

File Structure:

  • Go Project Root
    • Go files and project
    • SPA FE (in my case ui
      • spa.go
@SilverCory
SilverCory / README.md
Last active August 17, 2023 00:00
A tee logging implementation for slog golang. Log with multiple handlers.

Usage:

var logger = slog.New(
  NewTeeLogger(
    slog.NewJSONHandler(
      os.Stdout,
      &slog.HandlerOptions{
        AddSource:   false,
 Level: level,

Type Asset:

  {
    "id": 123123123123,
    "name": "asset_key",
    "type": 1
  }
  • ID: The ID of the asset
@SilverCory
SilverCory / KeyGen.go
Last active June 6, 2023 05:22
Vexera Premium key generator
package main
import (
"fmt"
"math/rand"
"strconv"
"strings"
)
var validKeys = ``
@SilverCory
SilverCory / Properties.java
Last active April 28, 2023 14:01 — forked from WesJD/Properties.java
Simple class for changing Minecraft server properties easily.
import org.bukkit.Bukkit;
import java.lang.reflect.InvocationTargetException;
public class Properties {
private static Class minecraftServerClass;
private static Class propertyManagerClass;
private static Method getServerMethod;
private static Method getPropertyManagerMethod;
@SilverCory
SilverCory / LocationAdapter.java
Created July 4, 2016 02:05
A location type adapter for Gson.
import com.google.gson.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import java.lang.reflect.Type;
/**
* A gson adapter for {@link org.bukkit.Location}.
* <p>
@SilverCory
SilverCory / CANBusLogger.pde
Last active August 25, 2022 01:20
BMW F800GS CANBUS headlight detection for a lightbar. (double tap and the lightbar will come on). For arduino.
/*
* The aim of this is to try to detect changes in messages.
* A change in a message should correlate to an action/operation performed on the vehicle.
*/
import processing.serial.*;
import java.lang.IllegalArgumentException;
import java.lang.System;
import java.util.Map;
@SilverCory
SilverCory / bike-emulator.ino
Last active June 10, 2022 12:39
Emergency Stopping Signal for ZX6R 1999 using ESP32 (Doesn't work bc too many interrupts
const int PIN_SPEED_SENSOR_OUT = 12;
const int PIN_BRAKE_LEVER_OUT = 13;
const int PIN_SLOW_TOUCH_1_IN = 4;
const int PIN_SLOW_TOUCH_2_IN = 32;
const int THRESHOLD = 30;
const int MAX_FREQ = 345;
void setup() {
@SilverCory
SilverCory / GlancePenis.go
Last active May 28, 2019 10:26
Draw a penis in glance
package main
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net/http"
"reflect"
"strconv"