Skip to content

Instantly share code, notes, and snippets.

View M3ales's full-sized avatar

Matthew M3ales

  • Luna Software Solutions
  • South Africa
  • 15:16 (UTC +02:00)
View GitHub Profile
@M3ales
M3ales / rsa_pem.dart
Created September 5, 2022 09:41 — forked from proteye/rsa_pem.dart
How to encode/decode RSA private/public keys to PEM format in Dart with asn1lib and pointycastle
import 'dart:convert';
import 'dart:math';
import 'dart:typed_data';
import "package:pointycastle/export.dart";
import "package:asn1lib/asn1lib.dart";
List<int> decodePEM(String pem) {
var startsWith = [
"-----BEGIN PUBLIC KEY-----",
"-----BEGIN PRIVATE KEY-----",
@M3ales
M3ales / gsuite-less-than-secure.md
Last active February 17, 2022 06:17
Google GSuite Enable Less Than Secure

Google GSuite Enable Less Than Secure Apps

Introduction

For when you need to use gmail smtp without OAuth or want to link up a less than secure app. This specifically details the extra steps needed for GSuite accounts.

Steps

  • Login to a Domain Administrator Account
@M3ales
M3ales / rxjs-unsubscribe.md
Last active May 11, 2022 23:09
RxJs Angular Destroyed Unsubscribed OnDestroy

RxJs Unsubscribe

Given:

export class Example implements OnDestroy {
    isLoading : boolean;
    isSaving : boolean;
    isUndoing : boolean;
_fnc_damageTarget = {
params["_target", "_numberOfWounds"];
private _parts = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"];
for [{private _i = 0}, {_i < _numberOfWounds}, {_i = _i + 1}] do {
[_target, 1, selectRandom _parts, "bullet"] call ace_medical_fnc_addDamageToUnit;
};
};
private _vehicle = vehicle player;
@M3ales
M3ales / IGamePatch.cs
Created July 21, 2018 00:52
My thoughts
using System.Reflection;
using System;
namespace Bookcase.Patches {
/// <summary>
/// This interface is used to mark a class as a loadable patch by Bookcase's patch loader.
/// </summary>
internal interface IGamePatch {
@M3ales
M3ales / Game1.parseDebugInput.cs
Last active October 31, 2021 00:15
All possible debug commands and their functionality, that can be invoked from the SMAPI console by using the 'debug' command. (1.3.24)
public bool parseDebugInput(string debugInput)
{
Game1.lastDebugInput = debugInput;
debugInput = debugInput.Trim();
string[] debugSplit = debugInput.Split(' ');
try
{
if (Game1.panMode)
{
if (debugSplit[0].Equals("exit") || debugSplit[0].ToLower().Equals("panmode"))
@M3ales
M3ales / StardewModdingReference.md
Last active July 12, 2018 01:40
Item Category Reference

Item Category Reference

Description

Simplified set of all known item categories. List is WIP. Check if the items you want are in the category you want by taking a look here at the objectInformation set, and read up here to learn about the format.

Item Categories

Item.Category : int

May take any of the relevant IDs, so you can use this reference to filter items by the relevant category

@M3ales
M3ales / StardewNotes.md
Last active July 10, 2020 03:43
Stardew Valley Modding Notes (What I've found)

Stardew Valley

Skip down to the Specific Datastorage Formats if you want the useful stuff. It's mostly just what I'm thinking so lots of speculation and development of reasoning (or me making lots of assumptions).

Notes on Game layout

  • Entrypoint is StardewValley.Program.cs:39
  • Game1 is a godclass holding the gamestate and most used Constants
  • Content is loaded using Microsoft.XNA.Framework.Content

The Dictionaries below are used to index most objects and are accessible under StardewValley.Game1.

public static IDictionary objectInformation;
@M3ales
M3ales / StardewNotes.md
Created July 11, 2018 12:32
Stardew Valley Modding Notes (What I've found)

Stardew Valley Notes on Game layout

Entrypoint is StardewValley.Program.cs:39 Game1 is a godclass holding the gamestate Content is loaded using Microsoft.XNA.Framework.ContentManager (StardewValley.LocalizedContentManager wraps it) Notes on Content Pipeline Stardew Valley makes use of

@M3ales
M3ales / search.bat
Created November 5, 2017 13:44
Searches folder and subfolder, the content of each file for the specified string, then prints the filename, and line+character offset. To use regex, add the /r flag to both findstr checks.
@echo off
:start
echo =============
echo New Search
echo =============
set /p "search=Search String:"
echo --
findstr /s /m %search% *.*
echo ----------
echo \\\\\\\