Skip to content

Instantly share code, notes, and snippets.

@odalet
odalet / TestInternedStrings.cs
Created July 22, 2015 06:51
Demonstrates compile-time string constants are interned in C#, and side-effects when using direct memory access to those strings.
using System;
namespace ConsoleApplication1
{
internal class Program
{
private static void Main(string[] args)
{
var s1 = "Immutable String";
var s2 = "Immutable String";
Module HelloWorld
Sub Main()
System.Console.WriteLine("Hello World")
End Sub
End Module
@odalet
odalet / ohlohApiExample.cs
Created August 15, 2010 16:08
Ohloh API Java sample translated to C#, F# and VB.NET
/*
This is an example of using the Ohloh API from C#.
Detailed information can be found at the Ohloh website:
http://www.ohloh.net/api
This example retrieves an account and simply shows the name associated.
Pass your Ohloh API key as the first parameter to this example.
Ohloh API keys are free. If you do not have one, you can obtain one
/*
This is an example of using the Ohloh API from Java.
Detailed information can be found at the Ohloh website:
http://www.ohloh.net/api
This examples retrieves a account and simply shows the name associated.
Pass your Ohloh API key as the first parameter to this example.
Ohloh API keys are free. If you do not have one, you can obtain one
@odalet
odalet / msdnKeys.xslt
Created May 2, 2013 12:59
MSDN Keys export viewer
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>MSDN Product Keys</h2>
<table border="1">
<tr bgcolor="#cccccc">
<th align="left">Product Name</th>
<th align="left">Key Type</th>
@odalet
odalet / certs-xp-fr.msc
Last active December 24, 2015 16:29
certs-xp-fr.msc
<?xml version="1.0"?>
<MMC_ConsoleFile ConsoleVersion="3.0" ProgramMode="Author">
<ConsoleFileID>{01801879-32DE-4F21-9E1C-497141CCAD41}</ConsoleFileID>
<FrameState ShowStatusBar="true">
<WindowPlacement ShowCommand="SW_SHOWNORMAL">
<Point Name="MinPosition" X="-1" Y="-1"/>
<Point Name="MaxPosition" X="-1" Y="-1"/>
<Rectangle Name="NormalPosition" Top="203" Bottom="945" Left="154" Right="1414"/>
</WindowPlacement>
</FrameState>
@odalet
odalet / certs-xp-en.msc
Created October 8, 2013 06:12
certs-xp-en.msc
<?xml version="1.0"?>
<MMC_ConsoleFile ConsoleVersion="3.0" ProgramMode="Author">
<ConsoleFileID>{549E388B-04AD-48CA-B7AC-4A781F265215}</ConsoleFileID>
<FrameState ShowStatusBar="true">
<WindowPlacement ShowCommand="SW_SHOWNORMAL">
<Point Name="MinPosition" X="-1" Y="-1"/>
<Point Name="MaxPosition" X="-1" Y="-1"/>
<Rectangle Name="NormalPosition" Top="145" Bottom="761" Left="110" Right="1129"/>
</WindowPlacement>
</FrameState>
@odalet
odalet / VS2012ToolStripRenderer.cs
Created December 5, 2013 15:17
dockpanelsuite 3.0 VS2012 Style: adding upper-case top-level menu items to the demo app. This code should be added to DockSample\VS2012ToolStripRenderer.cs
/// <summary>
/// Gets or sets a value indicating whether top-level menu items should be rendered upper case or not.
/// </summary>
/// <remarks>
/// Setting this property to <c>true</c> helps in simulating a VS2012/2013 style.
/// </remarks>
public bool EnableUpperTopLevelCaseMenuItems { get; set; }
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
@odalet
odalet / gist:d32560f89f0c1a5c9ad1
Created January 17, 2016 19:05 — forked from lontivero/gist:593fc51f1208555112e0
Generates Markdown from VS XML documentation file
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
namespace GithubWikiDoc
{
@odalet
odalet / sync_docker_time.ps1
Last active April 8, 2020 08:37 — forked from FilipChalupa/sync_docker_time.ps1
Synchronize your Docker date/time with the host clock - Mitigates https://github.com/docker/for-win/issues/4526
# NB: "Time Synchronization" is "Synchronisation date/heure" in French
$principal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if (-Not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "Elevated privileges are required."
Start-Process -FilePath "powershell" -ArgumentList "$('-File ""')$(Get-Location)$('\')$($MyInvocation.MyCommand.Name)$('""')" -Verb runAs
exit
}
Write-Host "--- Synchronizing your docker time ---"