Skip to content

Instantly share code, notes, and snippets.

View DanRigby's full-sized avatar

Dan Rigby DanRigby

View GitHub Profile
@DanRigby
DanRigby / gist:2591628
Created May 4, 2012 03:02
Handling compiled content files (*.xnb) for an XNA/MonoGame codebase
  • Create a folder named Content under the Project Folder.

  • Add to the XNA Windows project file:

    <PropertyGroup>
        <PostBuildEvent>xcopy "$(ProjectDir)$(OutDir)Content\*.*" "$(ProjectDir)Content" /S /I /R /Y</PostBuildEvent>
    </PropertyGroup>
@dragan
dragan / install-nuget.sh
Created May 5, 2012 21:41 — forked from half-ogre/install-nuget.sh
A bash script to install nuget.exe and make it available in bash with a proxy script
#!/usr/bin/env sh
set -e
# Respect PREFIX if set, otherwise default to /usr/local
if [ -z "${PREFIX}" ]; then
PREFIX="/usr/local"
fi
# Respect TMPDIR if set, otherwise default to /tmp
@jboner
jboner / latency.txt
Last active April 19, 2024 23:08
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@erichexter
erichexter / downloadBuildVideos.ps1
Created November 2, 2012 20:59
Download build 2012 videos
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
#Set the username for windows auth proxy
$rss.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/Build/2012/RSS/wmvhigh"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-") + ".wmv"
if (!(test-path $file))
{
@plaurin
plaurin / DependenciesVisualizer.linq
Last active August 17, 2018 10:41
LinqPad query to generate a DMGL of projects, libraries and NuGet packages dependencies
<Query Kind="Program" />
private string[] projectExtensionExclusions = new[] { ".vdproj", ".ndproj", ".wdproj", ".shfbproj" };
private string rootFolder = @"C:\Users\Pascal\Dev\MyProject";
void Main()
{
LoadAllProjects();
LoadAllPackagesConfig();
GenerateDGML(Path.Combine(rootFolder, "Dependencies.dgml"));
while (ReferenceNameNavigator.GetByQualifier(referenceName) != null)
referenceName = ReferenceNameNavigator.GetByQualifier(referenceName);
void Main()
{
var writeChanges = false;
var basePath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"..\.."));
UpdateVersions(basePath, writeChanges);
}
void UpdateVersions(string basePath, bool writeChanges = false)
{
@ayende
ayende / LetsEncryptClient.cs
Created January 11, 2018 22:26
ACME v2 client for Let's Encrypt
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@tomasaschan
tomasaschan / aks-restart-nodes.sh
Last active August 30, 2022 17:45
Rolling restart of all nodes in an AKS cluster
#!/bin/bash
set -e
resourceGroupDefault='<set your default here, to avoid having to specify in the common case>'
resourceGroup=${RESOURCE_GROUP:-$resourceGroupDefault}
clusterNameDefault='<set your default here>'
clusterName=${CLUSTER_NAME:-$clusterNameDefault}
regionDefault='<set your default here>'
region=${REGION:-$regionDefault}