Skip to content

Instantly share code, notes, and snippets.

@jhorsman
jhorsman / Cisco_Anyconnect.ps1
Created January 6, 2015 10:11
PowerShell to automate VPN connection with Cisco AnyConnect Secure Mobility Client
#Source www.cze.cz
#This script is tested with "Cisco AnyConnect Secure Mobility Client version 3.1.00495"
# Usage: & '.\Cisco_Anyconnect.ps1' [-Server <server name or ip>] [-Group <group>] [-User <user>] [-Password <password>]
#Please change following variables
#IP address or host name of cisco vpn, Username, Group and Password as parameters
param (
[string]$Server = $( Read-Host "Input server, please" ),
@jhorsman
jhorsman / semver-regex.md
Last active March 29, 2024 05:25
Semantic versioning regex
@jhorsman
jhorsman / enable-rdp.ps1
Created August 7, 2015 08:12
Enable Windows Remote Desktop Connection with PowerShell
# run as administrator
# reboot afterwards
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1
@jhorsman
jhorsman / install-tentacle.bat
Created October 10, 2017 08:43
Batch script to set up an Octopus Tentacle on an application server. This can be used while provisioning a web application server.
"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" create-instance --instance "Tentacle" --config "C:\Octopus\Tentacle.config"
"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" new-certificate --instance "Tentacle" --if-blank
"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance "Tentacle" --reset-trust
"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" configure --instance "Tentacle" --home "C:\Octopus" --app "C:\Octopus\Applications" --port "10933" --noListen "True"
"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --instance "Tentacle" --stop
"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" polling-proxy --instance "Tentacle" --proxyEnable "False" --proxyUsername "" --proxyPassword "" --proxyHost "" --proxyPort ""
"C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --instance "Tentacle" --start
REM "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" register-with --instance "Tentacle" --server "http://octopus-server:81" --name "ap
@jhorsman
jhorsman / Auto shutdown task.xml
Created March 5, 2013 15:20
Windows Task Scheduler task to shutdown the server after specified hours of idle time. This file can be imported in Windows Task Scheduler.
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-03-05T14:01:44.319601</Date>
<Author>TRAIN1\Administrator</Author>
<Description>Shut down the server after specified hours of idle time</Description>
</RegistrationInfo>
<Triggers>
<IdleTrigger>
<Enabled>true</Enabled>
@jhorsman
jhorsman / appsettings.json
Last active August 5, 2023 19:37
Proxy configuration in .NET Core appsettings.json. See https://gist.github.com/jhorsman/d995ded7e6f9ad2e2260cd4549aeaf26 for .NET Framework
{
"defaultProxy": {
"proxy": {
"-usesystemdefault": "True",
"-proxyaddress": "http://localhost:8500",
"-bypassonlocal": "False"
}
}
}
@jhorsman
jhorsman / pretty-print-json.ps1
Created May 6, 2015 09:38
Pretty print a JSON string in PowerShell
$json = @"
{"RevisionDate":"2015-03-03T13:32:23.577","Filename":"index","LastPublishedDate":"0001-01-01T00:00:00","PageTemplate":{"FileExtension":"html","RevisionDate":"2015-03-03T13:31:29.133","MetadataFields":{"includes":{"Name":"includes","Values":["system/include/header","system/include/footer","system/include/content-tools","system/include/left-navigation"],"FieldType":0},"view":{"Name":"view","Values":["GeneralPage"],"FieldType":0}},"Folder":{"PublicationId":"tcm:0-4-1","Id":"tcm:4-23-2","Title":"Templates"},"Publication":{"Id":"tcm:0-4-1","Title":"400 Example Site"},"OwningPublication":{"Id":"tcm:0-3-1","Title":"100 Master"},"Id":"tcm:4-208-128","Title":"Content Page"},"MetadataFields":{},"ComponentPresentations":[{"Component":{"LastPublishedDate":"0001-01-01T00:00:00","RevisionDate":"2015-03-03T13:32:04.423","Schema":{"Folder":{"PublicationId":"tcm:0-4-1","Id":"tcm:4-24-2","Title":"Schemas"},"RootElementName":"Article","Publication":{"Id":"tcm:0-4-1","Title":"400 Example Site"},"Id":"tcm:4-109-8","Tit
@jhorsman
jhorsman / main.cpp
Created January 26, 2018 18:09
Blink for Node MCU; Blinking the builtin led on GPIO pin 2.
/**
* Blink for Node MCU
* also see https://arduino.stackexchange.com/questions/38477/does-the-node-mcu-v3-lolin-not-have-a-builtin-led
*
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
#include "Arduino.h"
// On a NodeMCU board the built-in led is on GPIO pin 2
# Inspired by https://gist.github.com/jbratu/6262684939e15e638892973f5f8eed78 and https://stackoverflow.com/questions/55914397/enable-tls-and-disable-ssl-via-powershell-script
function Disable-SSL-2.0 {
New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -Force | Out-Null
New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' -name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null
New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' -Force | Out-Null
New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' -name Enabled -value 0 -PropertyType 'DWord' -Force | Out-Null
New-Ite
###########################################################################"
#
#
# NAME: PinnedApplications.psm1
#
# AUTHOR: Jan Egil Ring, Crayon
#
# DATE : 06.08.2010
#
# COMMENT: Module with the ability to pin and unpin programs from the taskbar and the Start-menu in Windows 7 and Windows Server 2008 R2.