Skip to content

Instantly share code, notes, and snippets.

@troyhunt
troyhunt / CreateAzureResources.ps1
Created January 22, 2015 13:12
Full script for provisioning all the resources I typically use for a new Azure website and database back end
# Per project params
$projectName = "TroyPSTest"
$hostName = "troypstest.troyhunt.com"
# Environment constants
$location = "West US"
$webResourceGroup = "Default-Web-WestUS"
$webHostingPlan = "DefaultServerFarm"
$dbResourceGroup = "Default-SQL-WestUS"
$dbServerName = "snyb5o1pxk"
@troyhunt
troyhunt / DeleteAzureResources.ps1
Created January 22, 2015 13:14
This one removes all the components I normally create for an Azure website
# Input params
$projectName = "TroyPSTest"
# Constants
$dbServerName = "snyb5o1pxk"
$dbServerLogin = "troyhunt"
$dbServerPassword = "P@ssw0rd"
$apiVersion = "2014-04-01"
# Computed vars
@troyhunt
troyhunt / Program.cs
Last active December 28, 2015 11:49
Does this code demonstrate the absolute max possible writes per second to an Azure storage table? I'm seeing it return averages of about 900 to 1,000 rows per second by batching inserts into 100 rows a go. Short of running batches async, is this code already optimal? Now revised to run each partition's batches in async. Throughput has jumped up …
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Net;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
namespace AzureSpeedTest

Keybase proof

I hereby claim:

  • I am troyhunt on github.
  • I am troyhunt (https://keybase.io/troyhunt) on keybase.
  • I have a public key whose fingerprint is 78BA 604B 30AA B4DF 818D BB64 01E3 4D93 E69D 9BDA

To claim this, I am signing this object:

@troyhunt
troyhunt / gist:3dc7ced2a53a33f7a72bab2aaa4282f6
Created April 22, 2016 05:59
A complete URL map for the migration of troyhunt.com
http://www.troyhunt.com/2011/06/brief-sony-password-analysis.html,https://www.troyhunt.com/brief-sony-password-analysis/
http://www.troyhunt.com/2013/05/your-login-form-posts-to-https-but-you.html,https://www.troyhunt.com/your-login-form-posts-to-https-but-you/
http://www.troyhunt.com/2014/09/everything-you-need-to-know-about.html,https://www.troyhunt.com/everything-you-need-to-know-about2/
http://www.troyhunt.com/2009/10/25-illustrated-examples-of-visual.html,https://www.troyhunt.com/25-illustrated-examples-of-visual/
http://www.troyhunt.com/2009/10/creating-your-own-custom-subversion.html,https://www.troyhunt.com/creating-your-own-custom-subversion/
http://www.troyhunt.com/2009/10/why-online-identities-are-smart-career.html,https://www.troyhunt.com/why-online-identities-are-smart-career/
http://www.troyhunt.com/2009/11/is-software-quality-really-important.html,https://www.troyhunt.com/is-software-quality-really-important/
http://www.troyhunt.com/2009/11/pdc09-roundup.html,https://www.troyhunt.com/pdc09-roun
http://troyhunt.ghost.io/102-simple-steps-for-installing-and/,https://www.troyhunt.com/102-simple-steps-for-installing-and/
http://troyhunt.ghost.io/10-commandments-of-good-source-control/,https://www.troyhunt.com/10-commandments-of-good-source-control/
http://troyhunt.ghost.io/10-email-security-fundamentals-for/,https://www.troyhunt.com/10-email-security-fundamentals-for/
http://troyhunt.ghost.io/10-graphic-examples-of-abomination-that/,https://www.troyhunt.com/10-graphic-examples-of-abomination-that/
http://troyhunt.ghost.io/10-illustrated-examples-of-visual/,https://www.troyhunt.com/10-illustrated-examples-of-visual/
http://troyhunt.ghost.io/10-lessons-for-uncultured-web-developers/,https://www.troyhunt.com/10-lessons-for-uncultured-web-developers/
http://troyhunt.ghost.io/10-tenets-of-pain-free-travel/,https://www.troyhunt.com/10-tenets-of-pain-free-travel/
http://troyhunt.ghost.io/10-things-i-learned-about-rapidly/,https://www.troyhunt.com/10-things-i-learned-about-rapidly/
http://troyhunt.ghost.io/10-wa
@troyhunt
troyhunt / TestCacheController.cs
Created August 20, 2016 21:10
A sliding cache implementation... that still expires after 1 second even with requests every 300ms
using System;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Caching;
using System.Web.Http;
namespace Web.Controllers
{
public class TestCacheController : ApiController
using System;
using System.Configuration;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
RemoveIpBlocks(log).Wait();
}
static async Task RemoveIpBlocks(TraceWriter log)
@troyhunt
troyhunt / BlockIpAtCloudFlare.csx
Last active September 25, 2016 08:03
Pick an IP address up off a queue and block it in CloudFlare
using System;
using System.Configuration;
public static void Run(string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
BlockIp(myQueueItem).Wait();
}
static async Task BlockIp(string ipAddress)
@troyhunt
troyhunt / pauls-san-neighbours.txt
Created October 10, 2016 15:56
Other names sharing the same SAN cert as paulcunningham.me
DNS Name=sni190998.cloudflaressl.com
DNS Name=*.begleitenbegleitenbegleiten.xyz
DNS Name=*.begleitendatum.xyz
DNS Name=*.beilufigmadchendatum.xyz
DNS Name=*.bijigu.top
DNS Name=*.chicasenganchatefiesta.xyz
DNS Name=*.chicasfiestagratis.xyz
DNS Name=*.citasescoltaescolta.xyz
DNS Name=*.datexxxhorny.xyz
DNS Name=*.datumhure.xyz