Skip to content

Instantly share code, notes, and snippets.

View wwwlicious's full-sized avatar

Scott Mackay wwwlicious

View GitHub Profile
@codebutler
codebutler / srv.cs
Created November 21, 2008 19:53
Simple C# wrapper for libresolv to perform DNS SRV lookups.
/*
* Simple C# wrapper for libresolv to perform DNS SRV lookups.
* Tested with Mono 2.0 on Linux and OSX.
*
* Copyright (c) 2008, Eric Butler <eric@extremeboredom.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@sandord
sandord / gist:400553
Last active September 24, 2023 08:17
Get property name from lambda expression
using System.Linq.Expressions;
/// <summary>
/// Returns the name of the specified property of the specified type.
/// </summary>
/// <typeparam name="T">The type the property is a member of.</typeparam>
/// <param name="property">The property expression.</param>
/// <returns>The property name.</returns>
public static string GetPropertyName<T>(Expression<Func<T, object>> property)
{
@dotnetchris
dotnetchris / gist:3636052
Created September 5, 2012 12:47
Simple ravendb backup script
$dest = "F:\Backup\Runs\backup-"+(Get-Date).ToString("yyyy-MM-dd HHmm")
.\Raven.Backup.exe --url=http://localhost/ --dest=$dest
& 'C:\Program Files\7-Zip\7z.exe' a $dest $dest
Remove-Item -Recurse $dest
using ServiceStack.WebHost.Endpoints;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security;
using ServiceStack.Common.Web;
using ServiceStack.Logging;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface;
@miketrebilcock
miketrebilcock / main.cs
Created July 2, 2013 19:10
Using TopShelf to Host Service Stack
public static void Main(string[] args)
{
var appSettings = new AppSettings();
AppConfig config = new AppConfig(appSettings);
HostFactory.Run(x =>
{
x.UseLog4Net();
x.Service<AppHost>(s =>
{
@danielmarbach
danielmarbach / MoqToFakeItEasy.DotSettings
Last active July 3, 2024 18:26
Structural Search and Replace Pattern for Migration from Moq to FakeItEasy with Resharper
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=23B254B63645A7449313D9A6F88A5C0C/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=23B254B63645A7449313D9A6F88A5C0C/Comment/@EntryValue">Replace Mock Field with FakeItEasy</s:String>
<s:Boolean x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=23B254B63645A7449313D9A6F88A5C0C/CustomPatternPlaceholder/=fieldName/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/StructuralSearch/Pattern/=23B254B63645A7449313D9A6F88A5C0C/CustomPatternPlaceholder/=fieldName/Properties/=CaseSensitive/@EntryIndexedValue">True</s:String>
<s:String x:Key="/Default/PatternsAndTempla
@oswaldoacauan
oswaldoacauan / styleguide.md
Created May 2, 2014 13:23
Ghostium - Styleguide Markdown
@jen20
jen20 / MessageIdentity.cs
Created August 19, 2014 17:39
Generator for deterministic GUIDs
public class MessageIdentity
{
public Guid NameSpace;
private readonly byte[] _namespaceBytes;
public MessageIdentity(Guid guidNameSpace)
{
NameSpace = guidNameSpace;
_namespaceBytes = guidNameSpace.ToByteArray();
SwapByteOrder(_namespaceBytes);
#!/bin/bash
source /etc/environment
name=$(cat /etc/machine-id)
if [ ! -f /opt/consul ]; then
mkdir /opt
mkdir /var/lib/consul
wget https://dl.bintray.com/mitchellh/consul/0.4.1_linux_amd64.zip
unzip 0.4.1_linux_amd64.zip
@carols10cents
carols10cents / c#-to-rust.md
Last active April 18, 2024 22:55
C# to Rust Cheat Sheet

Thanks to @seejee for making this for me!!!

C# to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in C# and Rust so that programmers most comfortable with C# can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables