Skip to content

Instantly share code, notes, and snippets.

@danieldownes
danieldownes / windows_winget_freshinstall.ps1
Last active November 15, 2024 10:46
Windows install list WinGet
:: Run from PS using:
:: powershell -executionpolicy bypass -File .\windows_winget_freshinstall.ps1
:: Install winget (from Windows Store, or..)
:: (for instructions for Windows sandbox)
$progressPreference = 'silentlyContinue'
Write-Information "Downloading WinGet and its dependencies..."
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile Microsoft.UI.Xaml.2.8.x64.appx
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityToolbarExtender;
/// <summary>
@danieldownes
danieldownes / gist:784af25818c3e7f8b118360d6663eb11
Created November 11, 2023 08:55
Resolve GIT LTS - file that should have been a pointer, but wasn't
git lfs migrate import --no-rewrite "broken file.jpg"
# OR older, and slower way:
git rm --cached -r .
git reset --hard
@danieldownes
danieldownes / Bash Merge files into single
Created April 12, 2023 22:08
Collapse many files into a single file
To collapse a whole project into a single file:
"cat files in current folder and all subfolders"
find . -type f -exec cat {} +
cat accepts multiple arguments:
cat * */*
@danieldownes
danieldownes / SceneLikeCamera
Created January 10, 2023 09:49
Camera controls like Unity Editor
using UnityEngine;
/// <summary>
/// Camera controls like Unity Editor.
/// </summary>
public class SceneLikeCamera : MonoBehaviour
{
[Header("Focus Object")]
[SerializeField, Tooltip("Enable double-click to focus on objects?")]
private bool doFocus = false;
@danieldownes
danieldownes / SearchForComponents.cs
Last active March 5, 2023 06:04
UnityEditor: Search For Components
//Assets/Editor/SearchForComponents.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class SearchForComponents : EditorWindow
{
[MenuItem("Tools/Search For Components")]
static void Init ()
@danieldownes
danieldownes / ToolsMenu.cs
Last active March 5, 2023 06:04
Unity Tools Menu - Clear PlayPrefs and Screenshot
using System;
using UnityEngine;
using UnityEditor;
public class ToolsMenu
{
[MenuItem("Tools/Clear PlayerPrefs")]
private static void ClearPlayerPrefs()
{
PlayerPrefs.DeleteAll();
@danieldownes
danieldownes / github-ci-unity-hololens2-windows-uwp.yml
Created March 30, 2022 10:19 — forked from cookieofcode/github-ci-unity-hololens2-windows-uwp.yml
Github Actions CI Unity HoloLens 2 Build (Windows, UWP)
# GitHub Actions CI for Unity Hololens 2 UWP running on windows.
name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
@danieldownes
danieldownes / commitFilesByModificationDate.sh
Last active May 21, 2024 05:04
Commit file and use last modified date as author commit date
#!/bin/bash
# Run directly from bash without download:
# curl -s https://gist.githubusercontent.com/danieldownes/c31b2107879555ebcb436a4e10d2826a/raw/ca495f5f28af778c72712472d279e27698c5606f/commitFilesByModificationDate.sh | bash
# Get list of all files in all folders and subfolders
# ignore file and '.git' folder
# Sort by modification date, desc
@danieldownes
danieldownes / RandomPointOnMesh.cs
Last active April 9, 2024 12:14 — forked from v21/gist:5378391
Random point on a mesh, for Unity3D
using UnityEngine;
using System.Collections.Generic;
/// <summary>
/// Get total area of each triangle.
/// Find a random point within that total area.
/// Lookup which triangle that point relates to
/// Find a randiom point which point that triangle
/// This works for all mesh types, and gives fully distributed results.
/// Gist: https://gist.github.com/danieldownes/b1c9bab09cce013cc30a4198bfeda0aa