Skip to content

Instantly share code, notes, and snippets.

@straightdave
straightdave / parser_sampler.go
Last active June 15, 2022 03:21
parse golang source file
package main
import (
"bytes"
"fmt"
"go/ast"
"go/parser"
"go/printer"
"go/token"
"strings"
@straightdave
straightdave / NX-param.json
Last active July 27, 2017 07:49
test params
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmCount": {
"value": 5
},
"adminUsername": {
"value": ""
},
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"omniPrefix": {
"type": "string",
"defaultValue": "legacytest"
},
"vmOS": {
"type": "string",
call winrm set winrm/config/service/auth @{Basic="true"}
call winrm create winrm/config/Listener?Address=*+Transport=HTTPS @{Hostname="%1";CertificateThumbprint="%2"}
@straightdave
straightdave / Configure-WinRM.ps1
Last active August 25, 2017 07:03
setting all network connections private before creating winrm listener of https
#################################################################################################################################
# Name : Configure-WinRM.ps1 #
# #
# Description : Configures the WinRM on an Azure machine #
# #
# Arguments : HostName, specifies the FQDN of machine or domain #
#################################################################################################################################
param
(
@straightdave
straightdave / Set-ConnPrivate.ps1
Created July 4, 2017 16:18
[win7] [powershell] set all connections private
# Get network connections
$networkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$connections = $networkListManager.GetNetworkConnections()
# Set network location to Private for all networks
$connections | % {$_.GetNetwork().SetCategory(1)}
# this is a must for creating winrm listener of https