Skip to content

Instantly share code, notes, and snippets.

View gjyoung1974's full-sized avatar
🎯
Focusing

Gordon Young gjyoung1974

🎯
Focusing
View GitHub Profile
@gjyoung1974
gjyoung1974 / listen-port.ps1
Created April 7, 2017 18:05
TCP Port listener & echo server
# A stupid TCP Listener
# telnet or netcat to the port
# type something and hit enter
# the typed bytes are echoed by this script
function listen-port ($port) {
$endpoint = new-object System.Net.IPEndPoint ([system.net.ipaddress]::any, $port)
$listener = new-object System.Net.Sockets.TcpListener $endpoint
$listener.start()
@gjyoung1974
gjyoung1974 / UserAdd.js
Last active November 4, 2018 01:14
manage local users for offline windows machines & set local security and group policies
/**
* Gordon Young 2012 Microsoft© Corporation UserAdd.js A script to create local
* users, remove local users, and update passwords The actual maintenance work
* begins in the section: ***Start of script:*** v0.10092012
*/
// Collect some environment variables:
var objShell = new ActiveXObject("WScript.Shell");
var objNetwork = WScript.CreateObject("Wscript.Network");
var strComputer = objNetwork.ComputerName;
node {
def mvnHome
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
git 'https://github.com/gjyoung1974/Secure_Connection_Pool.git'
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
mvnHome = tool 'M3'
}
@gjyoung1974
gjyoung1974 / tokenize.sh
Created June 12, 2017 00:00
tokenize string value
# Call the VGS proxy
# Argument $! is a clear text value, result is an FPE token value
curl -s https://{some-tenant}.environment.verygoodproxy.com/post \
-H "Content-type: application/json" \
-d '{"CCN": "'$1'"}' | jq --raw-output '.data' | jq --raw-output .CCN
@gjyoung1974
gjyoung1974 / detokenize.sh
Created June 12, 2017 00:02
Detokenize a value
# Call the VGS proxy
# Argument $! is an FPE token value, result is clear text value
curl -s https://httpbin.verygoodsecurity.io/post -k \
-x {0}:{1}@{sometenant}.{environment}.verygoodproxy.com:8080 \
-H "Content-type: application/json" \
-d '{"CCN": "'$1'"}' | jq --raw-output '.data' | jq --raw-output '.CCN'
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Gordon Young 2017 github_api_get_issues.py
import ssl
import urllib2
import json
import csv
# Create a fake SSL context to ignore the certificate error
@gjyoung1974
gjyoung1974 / diagram_sgs.sh
Created June 29, 2017 22:14
diagram_sgs.sh
#!/bin/bash
vpcs=$(eval 'aws ec2 describe-vpcs | jq -r ".Vpcs[] | .VpcId"')
for i in $vpcs
do
sgviz generate --format=png --output-path $i --region us-west-2 --vpc-ids $i
done
@gjyoung1974
gjyoung1974 / go_http_post.go
Created July 4, 2017 20:38
gloang http post
package main
import (
"fmt"
"bytes"
"io/ioutil"
"net/http"
)
func main() {
@gjyoung1974
gjyoung1974 / mov2gif.sh
Created August 3, 2017 17:07
mov2gif.sh - Convert quicktime screen video to animated GIF for documentation purposes
#!/bin/bash
ffmpeg -i $1 -vf "scale=min(iw\,600):-1" -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=7 --colors 128 > $1.gif
@gjyoung1974
gjyoung1974 / gencert.sh
Last active August 5, 2017 16:47
generate self signed cert + PKCS12
#!/bin/bash
# 2017 - Gordon Young : gordon.young@verygood.systems
# Bash shell script for generating self-signed certs.
# Script accepts a single argument, the fqdn (DNS name) for the cert
# ./gencert.sh www.test.local
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;