This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example creating certs for use with docker swarm | |
$openssl = 'C:\Program Files (x86)\OpenSSL\1.0.1L\bin\openssl.exe' | |
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False | |
$CN = "some-cert-name" | |
$Fqdn = "computer1.com" | |
# create a CA | |
& $openssl genrsa -aes256 -out ca-key.pem 4096 | |
& $openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem -subj "/CN=$CN" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from base64 import b64decode | |
from OpenSSL import crypto | |
def verify_chain_of_trust(certificate, trusted_cert_pems): | |
# Create and fill a X509Sore with trusted certs | |
store = crypto.X509Store() | |
for trusted_cert_pem in trusted_cert_pems: | |
trusted_cert = crypto.load_certificate(crypto.FILETYPE_PEM, trusted_cert_pem) | |
store.add_cert(trusted_cert) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Verb-Noun { | |
[CmdletBinding()] | |
param ( | |
# a normal parameter | |
[Parameter(ValueFromPipeline = $true)] | |
[System.String]$Name, | |
) | |
dynamicparam { | |
# a simple dynamic parameter, $PossibleCategories is discovered on module import | |
$DynamicParams = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS D:\fluffy-basson> docker network ls | |
NETWORK ID NAME DRIVER SCOPE | |
tsrtjyvcnda9 dsc_net overlay swarm | |
kecsl0ygqz7v ingress overlay swarm | |
250269d47835 nat nat local | |
262286df0819 none null local | |
PS D:\fluffy-basson> docker inspect dsc_net | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
pipeline { | |
agent any | |
stages { | |
stage ("check") { | |
when { | |
branch 'master' | |
} | |
steps { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import json | |
import os | |
from optparse import OptionParser | |
import requests | |
import sys | |
import pprint | |
import logging as log | |
__author__ = 'ravi, scottm' #http://javawithravi.com/automating-github-releases-via-jenkins/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018/07/04 13:50:53 [INFO] Terraform version: 0.11.7 41e50bd32a8825a84535e353c3674af8ce799161 | |
2018/07/04 13:50:53 [INFO] Go runtime version: go1.10.1 | |
2018/07/04 13:50:53 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"} | |
2018/07/04 13:50:53 [DEBUG] Attempting to open CLI config file: /home/scott/.terraformrc | |
2018/07/04 13:50:53 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
2018/07/04 13:50:53 [INFO] CLI command args: []string{"apply"} | |
2018/07/04 13:50:53 [INFO] command: empty terraform config, returning nil | |
2018/07/04 13:50:53 [DEBUG] command: no data state file found for backend config | |
2018/07/04 13:50:53 [DEBUG] New state was assigned lineage "73e74daa-be08-bfcc-39ed-cb987529f8fc" | |
2018/07/04 13:50:53 [INFO] command: backend initialized: <nil> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the old way I used to invoke sql queries. | |
# A better way now would be to use the SqlServer module and Invoke-SqlCommand | |
$tsqlQuery = @" | |
Select AccountName | |
From SUSDB.dbo.tbDownstreamServerTarget | |
"@ | |
Try { | |
$conn.Open() | |
} | |
Catch { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!groovy | |
// https://medium.com/rocket-travel-engineering/running-advanced-git-commands-in-a-declarative-multibranch-jenkinsfile-e82b075dbc53 | |
// Jenkins only checks out the branch for performance reasons so to be able to do more advanced git commands we need to | |
// also fetch master (or anything else you need) | |
pipeline { | |
agent any | |
stages { | |
stage ("info") { | |
when { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$PSBoundParameters.GetEnumerator() | | |
ForEach-Object -Begin { | |
$Width = $PSBoundParameters.Keys.Length | Sort-Object | Select-Object -Last 1 | |
} -Process { | |
"{0,-$($Width)} : '{1}'" -f $_.Key, ($_.Value -join ', ') | | |
Write-Verbose | |
} |
NewerOlder