Skip to content

Instantly share code, notes, and snippets.

View gjyoung1974's full-sized avatar
🎯
Focusing

Gordon Young gjyoung1974

🎯
Focusing
View GitHub Profile
{
"variables": {
"admin_user": "{{env `ADMIN_USER`}}",
"admin_password": "{{env `ADMIN_PASSWORD`}}",
"source_image": "{{env `SOURCE_IMAGE`}}",
"image_family": "{{env `IMAGE_FAMILY`}}",
"project_id": "{{env `PROJECT_ID`}}",
"network_id": "{{env `NETWORK_ID`}}"
},
"_comment": "Packs an image of Windows Server for GCP",
@gjyoung1974
gjyoung1974 / Vagrantfile.k8s.CentOS7.sh
Last active June 23, 2019 03:25
k8s cluster running on Centos7, KVM + LibVirt
# -*- mode: ruby -*-
# vi: set ft=ruby :
servers = [
{
:name => "k8s-master",
:type => "master",
:box => "centos/7",
:box_version => "1902.01",
:eth0 => "192.168.122.50",
@gjyoung1974
gjyoung1974 / ffmpeg.sh
Created June 10, 2019 18:16
Install FFMPEG
#!/bin/bash
brew install ffmpeg
brew cask install xquartz #dependency for gifsicle, only required for mountain-lion and above
open /usr/local/Cellar/x-quartz/2.7.4/XQuartz.pkg # runs the XQuartz installer (YOU NEED TO UPDATE THE PATH)
brew install gifsicle
@gjyoung1974
gjyoung1974 / minikube-rm.sh
Created June 6, 2019 13:03
minikube-rm && create
#!/bin/bash
minikube stop
minikube delete
rm -r -f $HOME/.minikube
minikube config set cpus 4
minikube config set memory 8196
minikube config set vm-driver hyperkit
# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
#!/usr/bin/env python
# This script gets a population of closed pull requests
from github import Github
import pandas as pd
from datetime import datetime
git_hub = Github("")
repo = git_hub.get_repo("")
pulls = repo.get_pulls(state='closed', sort='created', direction='desc')
#!/usr/bin/env python
# This script gets a population of closed pull requests
from github import Github
import pandas as pd
from datetime import datetime
git_hub = Github("")
repo = git_hub.get_repo("")
pulls = repo.get_pulls(state='closed', sort='created', direction='desc')
@gjyoung1974
gjyoung1974 / aws_cli_cheat_sheet.txt
Created March 30, 2019 01:52
AWS CLI Cheat sheet
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@gjyoung1974
gjyoung1974 / server.py
Created March 6, 2019 15:20
Inspect web requests - simple python web server
#!/usr/bin/env python
# print reuests from inbound HTTP methods GET, POST, PUT, and DELETE
# expose your service to the interwebs via http://serveo.net/
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@gjyoung1974
gjyoung1974 / mojave.sh
Created March 4, 2019 15:10
Make macOS Mojave DVD Iso
#!/bin/bash
# Create a High Sierra ISO for CICD stuffs
hdiutil create -o /tmp/Mojave.cdr -size 7500m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo '/Applications/Install macOS Mojave.app/Contents/Resources/createinstallmedia' --volume /Volumes/install_build --nointeraction --downloadassets
mv /tmp/Mojave.cdr.dmg ~/Desktop/InstallSystem.dmg
hdiutil detach /Volumes/Install\ macOS\ Mojave
hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/Mojave.iso