Skip to content

Instantly share code, notes, and snippets.

View dennisroche's full-sized avatar
🐱

Dennis Roche dennisroche

🐱
View GitHub Profile
@dennisroche
dennisroche / emoji.css
Last active November 15, 2017 03:38
Emoji
span.emoji
{
display: -moz-inline-box;
display: inline-block;
width: 1em;
height: 1em;
vertical-align: baseline;
text-indent: -9999px;
@dennisroche
dennisroche / kbd.css
Last active October 28, 2017 07:40
Style <kbd> tags
kbd
{
font-size: 15px;
line-height: 1.4;
display: inline-block;
margin: 0 .1em;
padding: .1em .6em;
@dennisroche
dennisroche / README.md
Last active October 25, 2017 13:31
Expand posh-git alias

Add PowerShell alias to your profile.

function Get-Git { & git $args }
New-Alias g Get-Git -Force -Option AllScope

This will alias g to git, however you forgo the tab expansion.

posh-git shell is replacing default TabExpansion function with own implementation.

@dennisroche
dennisroche / NodaClock.cs
Last active December 9, 2017 14:11
NodaTime Static Clock
public static class NodaClock
{
private static readonly AsyncLocal<IClock> ClockThreadSafe;
public static void ChangeClock(IClock clock)
{
ClockThreadSafe.Value = clock;
}
static ApiClock()
<#
.SYNOPSIS
This Azure Automation runbook automates the scheduled shutdown and startup of virtual machines in an Azure subscription.
.DESCRIPTION
The runbook implements a solution for scheduled power management of Azure virtual machines in combination with tags
on virtual machines or resource groups which define a shutdown schedule. Each time it runs, the runbook looks for all
virtual machines or resource groups with a tag named "AutoShutdownSchedule" having a value defining the schedule,
e.g. "10PM -> 6AM". It then checks the current time against each schedule entry, ensuring that VMs with tags or in tagged groups
are shut down or started to conform to the defined schedule.
@dennisroche
dennisroche / Remove-GitMergedBranches.ps1
Created September 23, 2016 06:04
A posh-git script that identifies local branches that have been merged to `master`.
function Remove-GitMergedBranches {
Write-Output "Fetching latest"
git fetch origin --prune
$currentBranch = & git rev-parse --abbrev-ref HEAD
if ($currentBranch -ne "master") {
Write-Output "Changing branch to master"
git checkout master
}
@dennisroche
dennisroche / Install-Seq.ps1
Last active February 23, 2017 19:30
Download and install Seq (https://getseq.net/). Can be used by Azure Resource Manager template. Use RawGit to access the file with proper Content-Type headers - https://rawgit.com/
[CmdletBinding()]
param (
[string]$SeqVersion,
[string]$SeqInstanceName,
[string]$SeqPort
)
$installBasePath = "C:\Install\"
$seqDataPath = "C:\ProgramData\Seq"

GitHub Markdown Style

Modified from https://github.com/sindresorhus/github-markdown-css.

Edited to work inside VSCode Markdown preview.

To use GitHub style markdown preview in VSCode, add the following to your local or workspace preferences.

@dennisroche
dennisroche / MessagingCenterEx.cs
Created May 4, 2016 05:27
Xamarin.Forms type-safe MessagingCenter
using System;
using Xamarin.Forms;
// ReSharper disable CheckNamespace
// Using global:: namespace
public static class MessagingCenterEx
{
private class MessagingCenterSender
{
@dennisroche
dennisroche / RunPSAsAdministrator.bat
Created May 3, 2016 01:50
Powershell, Add 'Run As Administrator' to right-click menu
@ECHO OFF
TITLE Enable right-click 'Run as Admin' for PowerShell
ECHO.
ECHO Enabling right-click 'Run as Admin' for PowerShell
ECHO.
:: Add value for UAC shield icon:
REG ADD "HKCR\Microsoft.PowerShellScript.1\Shell\runas" /v HasLUAShield /t REG_SZ /d "" /f
:: Add value to create context menu item: