Skip to content

Instantly share code, notes, and snippets.

@davidroberts63
davidroberts63 / dynamic-navbar.js
Created September 22, 2016 18:42
StrapdownJS Custom Wiki
var navbarHtml=`
<div id="the-navbar" class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<div id="headline" class="brand"></div>
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Style<b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="styleChoice"><a href="#">Amelia</a></li>
@davidroberts63
davidroberts63 / ReadAuditEventLogs.ps1
Created August 23, 2016 18:19
Read Audit Event Logs powershell
function FormatAuditTokens($text)
{
$text -Replace "%%1541", "SYNCHRONIZE" `
-Replace "%%4421", "Execute/Traverse" `
-Replace "%%1805", "Not granted" `
-Replace "%%4423", "ReadAttributes" `
-Replace "%%4416", "ReadData (or ListDirectory)" `
-Replace "%%1537", "DELETE" `
-Replace "%%1538", "READ_CONTROL" `
-Replace "%%1542", "ACCESS_SYS_SEC" `
@davidroberts63
davidroberts63 / AddSqlServiceDependency.ps1
Created July 19, 2016 02:56
Add's MSSQLSERVER as a dependency service to Octopus Deploy for use in test VMs that are started and stopped a lot.
$serviceName = "OctopusDeploy"
$cmd = "sc.exe config $serviceName depend= "
(Get-Service $serviceName | Select -ExpandProperty ServicesDependedOn) | % {$cmd += $_.Name + "/"}
$cmd += "MSSQLSERVER"
$cmd
Invoke-Expression $cmd -Verbose
Get-Service $serviceName | Select *
@davidroberts63
davidroberts63 / StartupEvents.ps1
Created July 17, 2016 03:33
Get machine startup events for event log (~bootup~) and Octopus deploy
$e = Get-WinEvent -FilterHashtable @{logname='System';id=6005,6006} | Select TimeCreated,Message
$o = Get-WinEvent -FilterHashtable @{logname='System';id=7036;data='OctopusDeploy'} | Select TimeCreated,Message
($e+$o) | Sort TimeCreated
Console.WriteLine("abedef".LastIndexOf("e","abedef".LastIndexOf("e")-1));
// --> 2
// Yes, a bit dirty, but if you use a regex then you'll have two problems.
@davidroberts63
davidroberts63 / Check-Secure-Channel-Settings.ps1
Last active February 10, 2017 23:20
Checks SSL/TLS settings on Windows
function CheckIsEnabled($description, $path, $name = "Enabled", [switch]$failIfEnabled)
{
if((Test-Path $path) -eq $false) {
Write-Host "$description is DISABLED due to non existent setting"
return
}
$property = Get-ItemProperty $path -name $name -ErrorAction SilentlyContinue
if($property -and $property.$name -ne 0)
{
@davidroberts63
davidroberts63 / ApologyToRobertG.md
Created May 27, 2016 17:57
Public apology to Robert G

I do herby publicly apologize to Robert G[redacted] for assuming he was using a term out of place, as others of lesser...thoughtfulness have done in the past. I shall henceforth retain in mind a higher expectation of Robert's requests and use of terminology.

@davidroberts63
davidroberts63 / Base64EncodeFile.ps1
Last active May 19, 2016 15:56
Converts a file to Base64 encoding. Useful for images you want to use in HTML. Just take the contents of the resulting .b64 file and put it in your image tag or CSS.
$fileName = "C:\Temp\SomeImage.png"
[Convert]::ToBase64String((Get-Content $fileName -Encoding Byte)) | Set-Content ($fileName + ".b64") -Force
CLEAR
$webUrl = "https://cibs.afcorp.afg"
Write-Host "Getting certificate for $weburl"
$request = [Net.WebRequest]::Create($webUrl)
$request.GetResponse() | Out-Null
$cert = $request.ServicePoint.Certificate
Write-Host "Getting chain"
@davidroberts63
davidroberts63 / crucible-repo-branches.md
Created April 27, 2016 19:54
REST call for list of branches indexed in Crucible repository

https://{YOUR CRUCIBLE URL}/changelog-ajax/{REPOSITORY.NAME}?q=&limit=51&command=branches

That will return something looking like:

{
    totalItems: 5,
    hasQuerySpecified: false,
    items: [
    {