Skip to content

Instantly share code, notes, and snippets.

@vbfox
vbfox / Program.cs
Created August 26, 2010 15:33
Sample code for SHOpenFolderAndSelectItems in C#
namespace SHOpenFolderAndSelectItems
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
@ikhwanhayat
ikhwanhayat / sl_listbox_stretch.xaml
Created November 9, 2010 03:01
Horizontally stretch items in ListBox
<ListBox x:Name="listMessage" Margin="5,5,5,5" Grid.Row="1">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignmen" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ItemsControl.ItemTemplate>
@mateusaubin
mateusaubin / howto.txt
Created September 8, 2012 01:19
Update Root Certificates
Automatic updates should in theory download an install all the required updates including the ones pertaining to updating the local machines root certificate store. This store should contain the latest list of certificates form the Microsoft Root Certificate Program Members CA's
If however for some reason you machines is unable to update these you can manually download the required Windows updates for this. Your machine might be updating from your corporate WSUS server where these updates might not have been approved.
Browse to the Microsoft Update Catalog http://catalog.update.microsoft.com/v7/site/home.aspx and search for "Certificate update"
You can filter down the list to your required OS by searching for "certificate updates windows server 2008"
You can get an overview of the update by clicking on the update title. If you still need further information there is also a link to the support KB article
@gmanny
gmanny / AlignableWrapPanel.cs
Created November 13, 2013 15:11
WrapPanel that respects HorizontalAlignment of its children, and fallbacks on the HorizontalContentAlignment property, when child doesn't have the alignment. Base upon this answer: http://stackoverflow.com/a/7747002
public class AlignableWrapPanel : Panel
{
public HorizontalAlignment HorizontalContentAlignment
{
get { return (HorizontalAlignment)GetValue(HorizontalContentAlignmentProperty); }
set { SetValue(HorizontalContentAlignmentProperty, value); }
}
public static readonly DependencyProperty HorizontalContentAlignmentProperty =
DependencyProperty.Register("HorizontalContentAlignment", typeof(HorizontalAlignment), typeof(AlignableWrapPanel), new FrameworkPropertyMetadata(HorizontalAlignment.Left, FrameworkPropertyMetadataOptions.AffectsArrange));
@Acapla
Acapla / simpleAwaitableQueue
Created January 22, 2014 07:59
simple awaitable queue
public class AwaitableQueue<T>
{
private readonly ConcurrentQueue<T> _queue = new ConcurrentQueue<T>();
private long _count = 0;
private readonly ConcurrentQueue<TaskCompletionSource<T>> _pending = new ConcurrentQueue<TaskCompletionSource<T>>();
/// <summary>
/// Enqueue the specified item. Blocking operation.
/// </summary>
/// <param name="item">Item.</param>
@wonderful-panda
wonderful-panda / MainWindow.xaml
Created January 29, 2015 15:00
[WPF]ListView.SelectedItemsとListViewItem.IsSelectedの挙動を確認するテストプログラム
<Window x:Class="WpfTraning.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:WpfTraning"
Height="300" Width="400">
<Window.DataContext>
<my:ViewModel/>
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
@yallie
yallie / ipctest.cs
Created February 24, 2016 12:28
Sample IPC server for wrapping around the static class
// Compile this code using: csc ipctest.cs /r:Zyan.Communication.dll
// First run — starts server.
// Second run — starts client.
using System;
using System.Linq;
using System.Text;
using Zyan.Communication;
using Zyan.Communication.Protocols.Ipc;
@bdrupieski
bdrupieski / SimpleFluentInterface.cs
Last active March 17, 2022 02:51
Simple fluent interface in C#
using System;
using System.Collections.Generic;
namespace SimpleFluentInterface
{
class Program
{
static void Main(string[] args)
{
string s = ListEnrollmentsSelectBuilder.Create()
@firomero
firomero / json
Created February 1, 2017 21:12
Provincias de Cuba
"Provincias": [{
"id": "1",
"nombre": 'Pinar del Río',
"municipios":["Consolación del Sur", "Guane", "La Palma", "Los Palacios", "Mantua", "Minas de Matahambre", "Pinar del Río", "San Juan y Martínez", "San Luis", "Sandino", "Viñales"]
}, {
"id": "2",
"nombre": 'Artemisa',
"municipios":[
"Alquízar", "Artemisa", "Bauta", "Caimito", "Guanajay", "Güira de Melena", "Mariel", "San Antonio de los Baños", "Bahía Honda", "San Cristóbal", "Candelaria"]
}, {
@krisleech
krisleech / renew-gpgkey.md
Last active July 19, 2026 03:37
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date: