Skip to content

Instantly share code, notes, and snippets.

View instance-id's full-sized avatar

instance.id instance-id

View GitHub Profile
@instance-id
instance-id / DIContainer.cs
Last active February 15, 2024 04:59
OneShot - Dependency Injection: Example Registration and Injection Handler
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using instance.id.DataTypes;
using instance.id.Logging;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityObject = UnityEngine.Object;
@instance-id
instance-id / RefreshGeneratedSource.cs
Last active July 12, 2022 03:52
Unity GenerateAuthoringComponent error for Entities 0.51 helper
using System.IO;
using UnityEditor;
using UnityEngine;
namespace instance.id.Editors
{
// --| Place this in an Editor folder and press Ctrl+Alt+R
// --| Will remove "GeneratedCode" folder and recompile
public static class RefreshGeneratedSource
{
@instance-id
instance-id / main.dart
Created February 11, 2022 00:52
Minimal Rust / Flutter project utilizing NativeShell, libadwaita, and adwaita
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:libadwaita/libadwaita.dart';
import 'package:nativeshell/nativeshell.dart';
import 'package:adwaita/adwaita.dart';
import 'package:window_decorations/window_decorations.dart';
void main() async {
runApp(MyApp());
}
@instance-id
instance-id / MS_Teams_Presence_NodeRed.js
Last active May 18, 2022 14:40
UserScript/TamperMonkey - Sends HTTP request to NodeRed HTTP Listener when web based Microsoft Teams status/presence changes to enable automated actions in NodeRed/HomeAssistant
// ==UserScript==
// @name Web Based Microsoft Teams Presence To NodeRed/HomeAssistant
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Sends HTTP request to NodeRed HTTP Listener when Web based Microsoft Teams status/presence changes to enable automated actions in NodeRed/HomeAssistant
// @author instance.id
// @match https://*.teams.microsoft.us/*
// @grant none
// ==/UserScript==
@instance-id
instance-id / CompileLocker.cs
Created November 24, 2021 16:21
Lock compilation so you can move folders and items without compiling on each one
using UnityEngine;
using UnityEditor;
// -- Place in Editor Folder ------------
namespace instance.id.Extensions.Editors
{
/// <summary>
/// This editor utility can lock/unlock unity script compile from menu item.
/// See more https://raspberly.hateblo.jp/entry/InvalidateUnityCompile
/// </summary>
@instance-id
instance-id / DragAssetConfirmation.cs
Created November 24, 2021 16:09
Unity Project View Asset Drag/Move Confirmation
// ----------------------------------------------
// -- Project View Asset Move Confirmation ------
// -- Place In Editor Folder --------------------
// ----------------------------------------------
using System;
using System.IO;
using UnityEditor;
internal sealed class DragAssetConfirmation : UnityEditor.AssetModificationProcessor
$webclient = New-Object System.Net.WebClient
$url = "https://github.com/darkoperator/Posh-SSH/archive/master.zip"
Write-Host "Downloading latest version of Posh-SSH from $url" -ForegroundColor Cyan
$file = "$($env:TEMP)\Posh-SSH.zip"
$webclient.DownloadFile($url,$file)
Write-Host "File saved to $file" -ForegroundColor Green
$targetondisk = "$($env:USERPROFILE)\Documents\PowerShell\Modules"
New-Item -ItemType Directory -Force -Path $targetondisk | out-null
$shell_app=new-object -com shell.application
$zip_file = $shell_app.namespace($file)
@instance-id
instance-id / SassCompiler.cs
Last active October 7, 2022 08:01
Write UIToolkit style code using Sass and have it converted automatically to a .uss file, usable in Unity. (Linux/Windows, but PC needs to have Sass installed)
#if UNITY_EDITOR
using System;
using System.IO;
using UnityEngine;
using UnityEditor;
using System.Linq;
using System.Diagnostics;
using UnityEngine.UIElements;
using Debug = UnityEngine.Debug;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
@instance-id
instance-id / flameshot-imgur.sh
Last active July 6, 2021 23:57
Using Flameshot as the screenshot capture tool with imgur-screenshot in place of scrot/maim, etc
#!/usr/bin/env zsh
# --------------------------------------------------------------------------------------------
# -- Using Flameshot (https://github.com/flameshot-org/flameshot) as the capture application
# -- with imgur-screenshot (https://github.com/jomo/imgur-screenshot) to upload imgur account
# --------------------------------------------------------------------------------------------
# -- borrowed these from the imgur-screenshot script ----
# -- to describe the filename format and output path ----
declare -g FILE_NAME_FORMAT="%Y-%m-%d_%H-%M.png"
declare -g FILE_DIR="${XDG_PICTURES_DIR:-$HOME/Pictures/upload}"
@instance-id
instance-id / _pc_setup_init.ps1
Last active April 20, 2021 02:27
Dev VM setup - still slightly WIP
# ------------------------------------------------- Dev PC Setup
# --------------------------------------------------------------
echo '-----------------------------'
echo 'Begin dev environment setup: '
echo '-----------------------------'
Update-ExecutionPolicy Unrestricted
# -------------------------------- Check for 10gb network adapter
$networkAdapter = Get-NetAdapter -InterfaceDescription 'Red Hat*' -ErrorAction SilentlyContinue | select -Property ifIndex