Skip to content

Instantly share code, notes, and snippets.

David Brower DavidBrower

  • Civica MDM
  • Glasgow, Scotland
View GitHub Profile
@DavidBrower
DavidBrower / git-log-to-tsv.sh
Created Mar 13, 2020 — forked from pwenzel/git-log-to-tsv.sh
Git Log to Tab-Delimited CSV File
View git-log-to-tsv.sh
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
@DavidBrower
DavidBrower / Robot.cs
Last active Feb 22, 2019
Technical Business Analyst Exercise
View Robot.cs
using System;
using System.Collections.Generic;
namespace Robotics
{
public static class Program
{
private static readonly Dictionary<string, Order> Orders = new Dictionary<string, Order>(StringComparer.OrdinalIgnoreCase)
{
["Start"] = Order.Start,
View commands.vim
<CR> : move to the start of the next line
- : move to the start of the previous line
^ : move to the start of the first word on the current line
0 : move to the start of the current line
$ : move to the end of the current line
P% : move to the point P% through the buffer
% : move between the matching bracket of a (), {}, [] pair
View .vimrc
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
set wildmenu
set wildmode=full
let mapleader = ","
" toggle on whether to show line numbers
nmap <leader>n :set number!<CR>
@DavidBrower
DavidBrower / docker.ps1
Created Jul 18, 2018
Docker Commands on Windows
View docker.ps1
Get-Content Dockerfile | docker build -
@DavidBrower
DavidBrower / Mongo.sh
Last active Jul 18, 2018
Mongo Commands
View Mongo.sh
--Get execution stats for a query
db.people.find({"ssn": "720-38-5636"}).explain("executionStats")
--Get explain object
exp = db.people.find({"ssn": "720-38-5636"}).explain("executionStats")
View LazySingleton.cs
public sealed class Singleton
{
private static readonly Lazy<Singleton> lazy = new Lazy<Singleton>(() => new Singleton());
public static Singleton Instance {=> lazy.Value;
private Singleton() {}
}
@DavidBrower
DavidBrower / Singleton.cs
Created Jul 13, 2018
Jon Skeet's Preferred Singleton
View Singleton.cs
public sealed class Singleton
{
private static readonly Singleton instance = new Singleton();
// Explicit static constructor to tell C# compiler
// not to mark type as beforefieldinit
static Singleton()
{
}
@DavidBrower
DavidBrower / SQLServerRestoreInfo.sql
Last active May 19, 2018
Get SQL Server Restore Information
View SQLServerRestoreInfo.sql
SELECT [rs].[destination_database_name],
[rs].[restore_date],
[bs].[backup_start_date],
[bs].[backup_finish_date],
[bs].[database_name] as [source_database_name],
[bmf].[physical_device_name] as [backup_file_used_for_restore]
FROM msdb..restorehistory rs
INNER JOIN msdb..backupset bs
ON [rs].[backup_set_id] = [bs].[backup_set_id]
INNER JOIN msdb..backupmediafamily bmf
@DavidBrower
DavidBrower / WindowsDeveloper.ps1
Created Jan 27, 2018
Set Up Windows Development Machine
View WindowsDeveloper.ps1
# Set PowerShell execution policy
Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy Bypass -Scope Process -Force
# Install Chocolatey
ex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install Boxstarter
. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
You can’t perform that action at this time.