Skip to content

Instantly share code, notes, and snippets.

View gjyoung1974's full-sized avatar
🎯
Focusing

Gordon Young gjyoung1974

🎯
Focusing
View GitHub Profile
#!/bin/env python3
from jira import JIRA
# Get these from ENV
user = "gordon.young@"
token = ""
jira_url = 'https://x.atlassian.net'
jira = JIRA(server=jira_url, basic_auth=(user, token))
@gjyoung1974
gjyoung1974 / keybase.md
Created January 23, 2020 01:27
keybase.md

Keybase proof

I hereby claim:

  • I am gjyoung1974 on github.
  • I am gyoung_pm (https://keybase.io/gyoung_pm) on keybase.
  • I have a public key ASAF8gGiFaeXCvDmIwloFWlqIl9HrqctHUPFK2P8M0YpqAo

To claim this, I am signing this object:

#!/usr/bin/env bash
#
# Summary: Use this script to rotat the root ssh key on an EC2 instance
function PrintHelp() {
echo "usage: $__base.sh [options...] "
echo "options:"
echo " -s --ssh-key-file Path to EC2 private ssh key file for the key to be replaced. Required."
echo " -h --host IP address or DNS name for the EC2 instance. Required."
echo " -a --aws-key-file The file for the .csv access key file for an AWS administrator. Optional. The AWS administrator"
@gjyoung1974
gjyoung1974 / gen_rsa.py
Last active December 29, 2019 16:16
Python Generate RSA via PKCS11
import pkcs11
# Load the library & select the token
lib = pkcs11.lib("/usr/local/lib/softhsm/libsofthsm2.so")
token = lib.get_token(token_label='root')
# Open a session on our token
with token.open(user_pin='1234') as session:
# Generate an RSA keypair in this session
pub, priv = session.generate_keypair(pkcs11.KeyType.RSA, 2048)
function Set-PasswordRemotely {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)][string] $UserName,
[Parameter(Mandatory = $true)][string] $OldPassword,
[Parameter(Mandatory = $true)][string] $NewPassword,
[Parameter(Mandatory = $true)][alias('DC', 'Server', 'ComputerName')][string] $DomainController
)
$DllImport = @'
[DllImport("netapi32.dll", CharSet = CharSet.Unicode)]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>ADOrganizationalUnit</key>
<string>OU=Company,OU=Computers</string>
<key>HostName</key>
#!/usr/bin/env python
import ldap
from utilities.conv_time import filetime_to_dt
# Instantiate LDAP object
l = ldap.initialize("ldap://1.1.1.1")
bind = l.simple_bind_s("[email protected]", "somePassw0rd")
l.protocol_version = ldap.VERSION3
l.set_option(ldap.OPT_REFERRALS, 0)
@gjyoung1974
gjyoung1974 / Migrate_Users.ps1
Created October 17, 2019 00:17
ADMT Active Directory Migrate Users
$SearchBase='OU=Users,OU=SomeOU,DC=ad,DC=SomeDomain'
$arr = Get-ADUser -Server "ad.SomeDomain" -SearchBase $SearchBase -Filter *
ForEach ($item in $arr) {
# Prepare the command line
$command = @'
cmd.exe /C C:\Windows\ADMT\admt.exe USER /n $item.SamAccountName.ToString() /o C:\users\SomeUser\options.ini
'@
# store the object:
#*********************************************************************************************
# Create a folder named C:\Script prior executing the Script and a BATCH file
# Also create a Text file named C:\Script\Script.txt.
# Paste the following command into the text file delete shadows all.
# It will delete all full server backup shadow copies for efficient disk space management.
#*********************************************************************************************
#Backup systemstate and delete all backups except last 4 copies.START
#wbadmin start backup -backuptarget:D: -allCritical -vssfull -quiet
#diskshadow.exe /s C:\Script\Script.txt
GITHUB_TOKEN="token"
export PS1="\[\e[34m\]\u\[\e[m\]\[\e[35m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]:\[\e[36m\]\w\[\e[m\]\[\e[33m\]\[\e[m\]:\\$\[\e[m\] "
alias dockerrm='docker rmi -f $(docker images -a -q)'
vpn()
{
sudo charon-cmd \