Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mrled on github.
  • I am mrled (https://keybase.io/mrled) on keybase.
  • I have a public key whose fingerprint is 1E06 1357 A257 E10E C0AF 747E 56D3 8EFB 7465 6AA0

To claim this, I am signing this object:

{
"variables": {
"testinputartifact": "C:\\Windows\\system32\\cmd.exe"
},
"builders": [
{
"type": "file",
"source": "{{user `testinputartifact`}}",
"target": "testing.box"
}
@mrled
mrled / BackUpAllDatabases.sql
Last active September 26, 2017 20:46
Back up all mssql databases
-- NOTE: Backs up to the default backup directory
DECLARE @prefix VARCHAR(20) -- a prefix for the filename, set below
DECLARE @name VARCHAR(50) -- database name, set automatically
DECLARE @fileName VARCHAR(256) -- filename for backup, set automatically
DECLARE @fileDate VARCHAR(20) -- used for file name, set automatically
SET @prefix = 'Autobackup'
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
@mrled
mrled / cloudbuilder.json
Last active August 31, 2017 01:06
wintriallab cloudbuilder template #bugreport
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Storage Account Name; must be a valid Azure DNS hostname"
}
},
@mrled
mrled / Show-OctopusVariables.ps1
Created August 31, 2017 01:03
[Show Octopus Variables in Powershell] #powershell #octopus
<#
.synopsis
Show Octopus parameters defined in files
.parameter rootPath
Search recursively from here.
If the tree is large, this command will take a long time. If you're working in a Git repository of a project directory, it might be worth running 'git clean -fxd' beforehand. This will delete all your bin/ and obj/ directories (meaning any binaries you have built will be deleted), but will make this command run faster.
.parameter filePattern
Look for files whose name matches this pattern. By default, only look for *.Octopus.config files.
#>
function Show-OctopusVariables {
@mrled
mrled / python_converting_timezones.markdown
Last active August 3, 2023 13:34
[Converting timezones from Windows to IANA in Python]

Converting timezones from Windows to IANA and back in Python

Spoiler alert: I couldn't end up doing this, jesus christ timezones are such a mess

General notes

There are many mappings between timezones.

  1. Obviously I could maintain one myself, but it's sufficiently complex that I don't want to take this on
  2. Unicode maintains a mapping of Windows to IANA zones, but it only has entryes for standard timezone names ("Pacific Standard Time") and not DST timezone names ("Pacific Daylight Time"): https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
@mrled
mrled / iptricks.markdown
Created September 21, 2017 18:55
Linux `ip` tricks

Linux ip tricks

# call like 'getips <INTERFACE> <FAMILY>'
# e.g. 'getips eth0 inet' might return 192.168.1.1/24
# e.g. 'getips eth0 inet6' might return fe80::4008:c2ff:fee8:fc93/64
# Note that this will retur all IPs of the family assigned to the interface - possibly more than one
getips() {
    if test $# != 2; then
        return 1

fi

@mrled
mrled / fix-elcapitan-vbox.sh
Last active October 10, 2017 00:30
Fix macOS El Capitan VirtualBox VM
#!/bin/sh
usage() {
cat <<ENDUSAGE
$0: Apply required virtual firmware changes so that El Capitan will run under VirtualBox
Usage: $0 <VM_NAME>
ENDUSAGE
}
if test $# -ne 1 || test "$1" == "-h" || test "$1" == "--help"; then
@mrled
mrled / invisible_states_of_america.tsv
Last active October 10, 2017 00:52
UEL ARAMCHEK's INVISIBLE STATES OF AMERICA tsv
STATE TOURISM GUIDE
WEST DAKOTA Here, goblets of diesel fuel are burned in offering to the railroad gods. Locals make omelettes using the eggs of rattlesnakes.
APSYLANIA A land of snow and rust where only water towers can survive. Their long, iron tentacles guard the tombs of forgotten presidents.
AGASSIZ A colossal lead heart that connects all sewers throbs just beneath this state's surface. Its palpitations are felt as earthquakes.
SELIMA Known for pan-fried hornets dipped in maple salsa. The Roosevelt National Labyrinth begins near its eastern border, and never ends.
OROCROIX Scarecrows stuffed with telephone wire fill the few ghost towns that remain here. They subsist on our expended alkaline batteries.
ELKANSAS In the famous Deepweather Caves, tornadoes slumber in jet-black chrysalises. Tourists can get up close and hear their heartbeats.
NEW BELARUS Every other summer, its sun-drunken residents gather together in the countryside and burn a cumulonimbus cloud to the ground.
MISUSCHAQUA The Sword of Chevr
@mrled
mrled / gitconfig.markdown
Created October 10, 2017 01:26
Git configuration notes

Git configuration

FSCK objects

You probably want to enable object fscking, which will protect against some hypothetical attacks on SHA1

git config --global transfer.fsckobjects true
git config --global fetch.fsckobjects true