Skip to content

Instantly share code, notes, and snippets.

@hyrious
hyrious / restore-desktop-ini.md
Last active May 10, 2024 00:10
restore desktop.ini if some guy messed them up

Take %UserProfile%\Desktop\desktop.ini for example.

  1. Create a desktop.ini file with content below and saved in UTF-16 LE with BOM. Hopefully notepad.exe has such choice to use the right encoding.
[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21769
IconResource=%SystemRoot%\system32\imageres.dll,-183
@Skibisky
Skibisky / MessagePasser.cs
Created February 27, 2019 06:23
Working example for sending a string between C# handles (Controls/Forms) using WM_COPYDATA.
/* ===================
* WM_COPYDATA example
* ===================
*
* Working example for sending a string between C# handles (Controls/Forms) using WM_COPYDATA.
*
* TODO:
* -----
* * Add more info
* * Make generic struct copying work
@andygock
andygock / sync-to-external.cmd
Created April 14, 2017 08:09
Script to sync one directory to another using robocopy (suitable as a form of backup)
@echo off
setlocal
:: set target and source directory, do not use a trailing slash
:: recommended: sync to a subdir on target drive
set source_drive=z:
set target_drive=p:\drive_z
:: exclude these dirs from sync
set excluded_dirs=exclude1 exclude2 "exclude 3"
@mikedavies-dev
mikedavies-dev / gist:989dd86a1ace38a9ac58
Created May 27, 2015 09:40
A simple log file monitor class for .NET
/*
A simple log file monitor class for .NET
Uses a threaded timer to check for changes in the file, if the file length has changed then the unread
section of the file is read and parsed into lines before being passed back to the event handler.
Note, because the class uses the threaded timer callbacks on the event hander WILL be made form a
different thread, keep this in mind when using the class.
@angularsen
angularsen / MarginSetter.cs
Created January 17, 2015 12:19
WPF - Automatic horizontal or vertical spacing in StackPanel and other list like panels
using System.Windows;
using System.Windows.Controls;
using JetBrains.Annotations;
namespace Foo
{
public class MarginSetter
{
private static Thickness GetLastItemMargin(Panel obj)
{
internal static IEnumerable<string> ReadLines(this string s)
{
string line;
using (var sr = new StringReader(s))
while ((line = sr.ReadLine()) != null)
yield return line;
}