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 / UpdateRepos.ps1
Last active March 27, 2021 03:58
Auto pull all git repos that reside within a parent directory. (For those of us who are repo hoarders).
#!/usr/bin/env pwsh
<#
.NOTES
===========================================================
Created on: 03/26/2021
Created by: instance.id
Platform: Linux/Windows
Filename: updaterepos.ps1
PSVersion: 7.2-preview4
@instance-id
instance-id / profile.ps1
Created March 22, 2021 22:44
PowerShell $PROFILE
$env:PYTHONIOENCODING = 'utf-8'
Set-Alias Edit "C:\Users\$($env:UserName)\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe"
# -------------------------------------------------------------- Functions
function move-the-cursor([int]$x, [int] $y) { $Host.UI.RawUI.CursorPosition = New-Object System.Management.Automation.Host.Coordinates $x , $y; $Host.UI.Write('Hello') }
function RunAsAdmin { Start-Process -Verb RunAs (Get-Process -Id $PID).Path }
function Update-PowerShell { Update-PowershellCore -UsePackageManagement 'Yes' -DownloadDirectory "$HOME\Downloads" }
function ListFoldersByDate { dir | Sort-Object -Property LastWriteTime }
function ChocoUpdate { & choco update all }
function ChocoList { & choco list --local-only }
@instance-id
instance-id / clone.ps1
Created March 16, 2021 03:56
A Linux PowerShell script to clone a GitHub repo and then go to that directory. Because I wanted to, that's why.
#!/usr/bin/env pwsh
# -- Either make sure clone.ps1 is on your path,
# -- or use the full path in the alias
# -- You can then setup the following Alias
# -- alias clone='f() { cd $(clone.ps1 $1) };f'
# -- Usage: ~ » clone github.com/instance-id/desiredrepo
Param (
@instance-id
instance-id / powershell_snippets.ps1
Last active August 3, 2022 20:24
PowerShell Snippets I don't want to forget.
# -- String aggregation from an array of PSObject ---------------------------------
# -- Takes an Array: -------------------------------
$array = @("string1","string2","string3","string4","string5")
[Func[string, string, string]]$aggregator = { param ($first, $next) $first + "${next}, "; };
$output = [System.Linq.Enumerable]::Aggregate([string[]]$array, [string]::Empty, $aggregator);
# -- Produces a string: ----------------------------
Write-Host $output
# -- $_> string1, string2, string3, string4, string5
@instance-id
instance-id / firefoxdeveloperedition.desktop
Created February 26, 2021 22:06
Linux Firefox Developers Edition - Stacked taskbar icon (So that opened windows stack under the actual launcher icon when favorited)
# In /usr/share/applications/ create a file named 'firefoxdeveloperedition.desktop' and put the following in it (If you installed it somewhere other than /opt/firefox/firefox - change the line Exec=/opt/firefox/firefox to reflect this change)
[Desktop Entry]
Version=1.0
Name=Firefox Developer Edition
Comment=Browse the World Wide Web
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer
Exec=/opt/firefox/firefox
Terminal=false
@instance-id
instance-id / TextProcessor.cs
Created December 8, 2020 05:19
Threaded text processor
// -- Found : https://stackoverflow.com/a/32276788/5821692 ----
// -- User : displayName -------------------------------------
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading.Tasks;
namespace ConsoleApplication
{
@instance-id
instance-id / unitytool.ps1
Last active October 3, 2022 18:32
Launch unity project by name (automatically in correct editor version). Automatically fix Unity: "Failed to load layout window" issue. Create new project from CLI. Add packages / assets to project before launch
#!/usr/bin/env pwsh
<#
.NOTES
============================================================
Last Edit: 5/29/2021
Created by: instance.id (https://github.com/instance-id)
Platform: Windows/Linux
Filename: unitytool.ps1
PSVersion: Last tested with 7.2-preview5
@instance-id
instance-id / unityfixlayout.ps1
Last active November 23, 2020 03:11
Unity: "Failed to load layout window" fix. See new version : https://gist.github.com/instance-id/3161cc2b5343db5bc3cef494d83a7449
#--------------------------------------------------------------------------------------------------------------
# This has been updated and changed to include several new features. See the link below for updated version: --
# https://gist.github.com/instance-id/3161cc2b5343db5bc3cef494d83a7449 ----------------------------------------
#--------------------------------------------------------------------------------------------------------------
# Replace folder paths in $projectLocations array (line 20) with your actual Unity project folder path(s)
# Usage: .\unityfixlayout.ps1 -Project MyProjectName
Param (
[Parameter()]
@instance-id
instance-id / Unity_backup_project_list.ps1
Last active November 3, 2020 00:20
Unity project backup via RClone using Powershell ()
# Put the Unity projects you want to back up in this list, then this is the file that you run to perform the backups.
# This script calls the main script and passes in the below data for each project you want to backup.
&C:\Users\***YOUR_USER_NAME***\.backup\_projects\projects_backup.ps1 -Project My_killer_game -Source E:\_unity\_projects\My_killer_game
&C:\Users\***YOUR_USER_NAME***\.backup\_projects\projects_backup.ps1 -Project My_other_killer_game -Source E:\_unity\_projects\My_other_killer_game
# ^-- Change to your username and location of ^-- Name of Project ^ Project source file location
# project_backup.ps1 and Unity.fltr file
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace MultiplayerARPG
{
public class ClassList : EditorWindow
{