Skip to content

Instantly share code, notes, and snippets.

View mitchdenny's full-sized avatar
💭
Currently setting my user status :)

Mitch Denny mitchdenny

💭
Currently setting my user status :)
View GitHub Profile
@mitchdenny
mitchdenny / Program.cs
Last active November 13, 2022 06:33
PartitionedRateLimiter does not honour AutoReplenishment = false
using System.Threading.RateLimiting;
var concurrency = 1;
var partitionedRateLimiter = PartitionedRateLimiter.Create<Guid, Guid>((r) =>
{
return RateLimitPartition.Get(r, (key) =>
{
var rateLimiter = new TokenBucketRateLimiter(new()
{
#!/bin/bash
# Check that the jq utility is installed.
which jq > /dev/null
if [ $? -ne 0 ]; then
echo "jq package not detected. Install using: sudo apt install jq"
exit 1
fi
# Check that the Azure CLI is installed.
@mitchdenny
mitchdenny / Clean-GitBranches.ps1
Last active October 24, 2021 23:47
PowerShell one-liner to clean up all the branches in your local clone except for master. Be careful!
git branch | % { $_.Replace("*", "").Trim() } | where { $_ -ne "main" } | % { git branch -D $_ }
parameters:
Artifacts: []
ArtifactName: 'not-specified'
stages:
- stage: Signing
dependsOn: ${{parameters.DependsOn}}
jobs:
- deployment: SignPackage
environment: wherewesign
@mitchdenny
mitchdenny / Program.cs
Created June 15, 2016 20:59
Executing a WIQL Query
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace FlatQuerySample
@mitchdenny
mitchdenny / server.js
Created March 15, 2013 04:32
Some code that shows how to implement background execution in Node running on Windows Azure (or iisnode generally).
var status = {
started: Date.now(),
heartbeat: Date.now(),
runtime: null
};
var heartbeater = function() {
status.heartbeat = Date.now();
status.runtime = status.heartbeat - status.started;
setTimeout(heartbeater, 1000);
@mitchdenny
mitchdenny / Web.config
Last active December 14, 2015 23:39
Example code to support executing Node.js in a particular sub-folder of an ASP.NET web-site.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="Node">
<system.webServer>
<handlers>
<add name="iisnode" path="*.js" verb="*" modules="iisnode" />
</handlers>
<defaultDocument enabled="true">
<files>
<add value="server.js" />
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>Excel Selection Changed Demo</title>
<link rel="stylesheet" type="text/css" href="../Content/Office.css" />
<link rel="stylesheet" type="text/css" href="../Content/App.css" />
<script src="../Scripts/jquery-1.7.1.js"></script>
<!--<script src="https://appsforoffice.microsoft.com/lib/1.0/hosted/office.js"></script>-->
@mitchdenny
mitchdenny / MainViewModel.cs
Created February 2, 2013 10:53
Some code from a WP8 application that uses the proximity sensor.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;
using Windows.Networking.Proximity;
@mitchdenny
mitchdenny / pisetup.sh
Created December 27, 2012 04:33
A quick little script to remind me of the packages that I like to install on my Raspberry Pi device.
sudo apt-get install nodejs npm node-semver
sudo apt-get install mono-complete
sudo apt-get install emacs