Skip to content

Instantly share code, notes, and snippets.

View idiotandrobot's full-sized avatar

Michael Phillips idiotandrobot

View GitHub Profile
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
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)");
Regex illegalInFileName = new Regex(@"[\\/:*?""<>|]");
string myString = illegalInFileName.Replace(myString, "");
scp –r pi@mynaturewatchcamera:/home/pi/NaturewatchCameraServer/naturewatch_camera_server/static/data ~/Desktop/data
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");
<Application x:Class="WpfTrayIcon.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ShutdownMode="OnExplicitShutdown"
>
<Application.Resources>
</Application.Resources>
</Application>
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$utf8 = New-Object -TypeName System.Text.UTF8Encoding
$String = "Hello, world!"
$Hash = ([System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($String)))).replace("-","").ToLower()
public static Icon IconFromImage(Image img) {
var ms = new System.IO.MemoryStream();
var bw = new System.IO.BinaryWriter(ms);
// Header
bw.Write((short)0); // 0 : reserved
bw.Write((short)1); // 2 : 1=ico, 2=cur
bw.Write((short)1); // 4 : number of images
// Image directory
var w = img.Width;
if (w >= 256) w = 0;
$ git clone https://gist.github.com/DannyQuah/5f43f9b75970bc4e357e42c7c9214b5d 2020.05-D.Quah-Managing-Gists-Locally.md
dotnet tool update --global powershell