Skip to content

Instantly share code, notes, and snippets.

@tjrobinson
tjrobinson / InstallHubFlow.ps1
Created October 9, 2017 09:07 — forked from mastilver/InstallHubFlow.ps1
Hubflow windows installer
Add-Type -AssemblyName System.IO.Compression.FileSystem
$TEMP = $([environment]::GetEnvironmentVariable("TEMP", "User"))
$CWD = $(Split-Path $MyInvocation.MyCommand.Path)
$PATH = $([environment]::GetEnvironmentVariable("PATH", "User"))
$git_folder = "C:\Program Files\Git"
$git_bin_folder = "$($git_folder)\bin"
$tmp_folder = "$($TEMP)\$([guid]::NewGuid())";
@AndyPook
AndyPook / boxstarter
Last active May 11, 2017 14:32
boxstarter script
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -EnableOpenFileExplorerToQuickAccess -EnableShowRecentFilesInQuickAccess -EnableShowFrequentFoldersInQuickAccess -EnableExpandToOpenFolder
Enable-RemoteDesktop
Update-ExecutionPolicy Unrestricted -Force
Disable-InternetExplorerESC
Disable-BingSearch
cinst chocolatey
cinst Boxstarter
@bertwagner
bertwagner / JSON_VALUE.sql
Last active September 22, 2017 12:30
SQL Server 2016 JSON's JSON_VALUE() Function
-- See https://gist.github.com/bertwagner/356bf47732b9e35d2156daa943e049e9 for a formatted version of this JSON
DECLARE @garage nvarchar(1000) = N'{ "Cars": [{ "Make": "Volkswagen", "Model": { "Base": "Golf", "Trim": "GL" }, "Year": 2003, "PurchaseDate": "2006-10-05T00:00:00.000Z" }, { "Make": "Subaru", "Model": { "Base": "Impreza", "Trim": "Premium" }, "Year": 2016, "PurchaseDate": "2015-08-18T00:00:00.000Z" }] }'
SELECT JSON_VALUE(@garage, '$.Cars[0].Make') -- Return the make of the first car in our array
-- Output: Volkswagen
SELECT CAST(JSON_VALUE(@garage, '$.Cars[0].PurchaseDate') as datetime2) -- Return the Purchase Date of the first car in our array and convert it into a DateTime2 datatype
-- Output: 2006-10-05 00:00:00.0000000
SELECT JSON_VALUE(@garage, '$.Cars') -- This returns NULL because the values of Cars is an array instead of a simple object
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
using SlackAPI;
var client = new SlackSocketClient("[SLACK_TOKEN]");
client.Connect((connected) =>{}, () =>{
Console.WriteLine("Connected");
client.PostMessage(
resp => {
Console.WriteLine("Posted");
},
"[CHANNEL]",
@skotzko
skotzko / gist:de23e02aa71a6817aa09
Last active July 29, 2020 04:44
Akka.NET Fundamentals Cheatsheet
@haacked
haacked / download-nuget-licenses.ps1
Last active September 5, 2022 16:35
A PowerShell script to download your NuGet package licenses as first seen in http://haacked.com/archive/2015/03/28/download-nuget-package-licenses/
Split-Path -parent $dte.Solution.FileName | cd
New-Item -ItemType Directory -Force -Path ".\licenses"
@( Get-Project -All | ? { $_.ProjectName } | % { Get-Package -ProjectName $_.ProjectName } ) | Sort -Unique Id | % { $pkg = $_ ; Try { (New-Object System.Net.WebClient).DownloadFile($pkg.LicenseUrl, (Join-Path (pwd) 'licenses\') + $pkg.Id + ".html") } Catch [system.exception] { Write-Host "Could not download license for $($pkg.Id)" } }
@ThatRendle
ThatRendle / README.md
Last active August 5, 2017 13:35
Vagrantfile to run Kafka in boot2docker

Kafka in Docker in Vagrant

I'm using this Vagrantfile to run Kafka on a Windows 8.1 laptop for development purposes.

It runs the ultra-lightweight boot2docker Linux, then uses Vagrant's Docker provisioning support to spin up ZooKeeper and Kafka.

The fun bits to work out were:

  • You need to forward the ports on both Vagrant (lines 13 & 14) and Docker (the -p flag), so you can access the instance from Windows using localhost:9092
@davidfowl
davidfowl / dotnetlayout.md
Last active November 13, 2024 13:19
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
using System.Globalization;
using Irony.Parsing;
namespace Grammar
{
[Language("LuceneGrammar", "1.0", "Lucene Grammar")]
public class LuceneGrammar : Irony.Parsing.Grammar
{
public LuceneGrammar()
: base(true) // true means case sensitive