Skip to content

Instantly share code, notes, and snippets.

View idiotandrobot's full-sized avatar

Michael Phillips idiotandrobot

View GitHub Profile
View windows-explorer-open-with-code.reg
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""
; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
View get_head_commit_message.yaml
#runs-on: windows-latest
# steps:
# - uses: actions/checkout@v3.5.2 #
- name: Get Head Commit Message
id: get_head_commit
shell: pwsh
run: |
$Message = git log --format=%B -n 1 HEAD
Write-Output "title=$($Message | Select -First 1)" >> $Env:GITHUB_OUTPUT
Write-Output "body=$($Message | Select -Skip 1)" >> $Env:GITHUB_OUTPUT
View broken-wsl.cmd
lxrun /uninstall /full`
lxrun /install`
View wpf-page-in-frame.xaml
View wpf-system-net-sockets-error.xml
View syndicationclient-error.cs
var client = new SyndicationClient();
client.SetRequestHeader("accept", "text/html, application/xhtml+xml, */*");
client.SetRequestHeader("user-agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)");
View removing-characters-forbidden-in-windows-filenames.cs
Regex illegalInFileName = new Regex(@"[\\/:*?""<>|]");
string myString = illegalInFileName.Replace(myString, "");
View mynaturewatchcamera-download-all.bat
scp –r pi@mynaturewatchcamera:/home/pi/NaturewatchCameraServer/naturewatch_camera_server/static/data ~/Desktop/data
View PowerShellInvoke.cs
string directory = ""; // directory of the git repository
using (PowerShell powershell = PowerShell.Create()) {
// this changes from the user folder that PowerShell starts up with to your git repository
powershell.AddScript($"cd {directory}");
powershell.AddScript(@"git init");
powershell.AddScript(@"git add *");
powershell.AddScript(@"git commit -m 'git commit from PowerShell in C#'");
powershell.AddScript(@"git push");
View App.xaml
<Application x:Class="WpfTrayIcon.App"