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 / sim900a-http-post.ino
Created June 7, 2018 03:36
Sim900a HTTP Post client
#include<SoftwareSerial.h>
SoftwareSerial client(2,3);
String reading="{ \" : 1, \"latitude\" : 12.983027, \"longitude\" : 80.2594, \"timestamp\" : 100, }";
void setup()
{
Serial.begin(9600);
@gjyoung1974
gjyoung1974 / dockerm.sh
Created May 30, 2018 17:25
Docker artifact cleanup script
#!/bin/bash
# options:
# remove stopped containers and untagged images
# $ dkcleanup
# remove all stopped|running containers and untagged images
# $ dkcleanup --reset
# remove containers|images|tags matching {repository|image|repository\image|tag|image:tag}
# pattern and untagged images
# $ dkcleanup --purge {image}
@gjyoung1974
gjyoung1974 / kube.sh
Created May 15, 2018 00:36
Initialize Minikube - Local Kubernetes cluster on macOS
#!/bin/bash
export KUBECONFIG=$HOME/.kube/config
#Download an OSX binary minikube
# minikube-darwin-amd64
#
# https://github.com/kubernetes/minikube/releases
# Put it somewhere that you can run it from: /usr/local/bin/minikube && chmod +x /usr/local/bin/minikube
# Download Docker Machine Hyperkit Driver
var aws = require('aws-sdk'),
https = require('https'),
zlib = require('zlib');
util = require('util');
// If you've used KMS to encrypt your slack, insert your CiphertextBlob here
var ENCRYPTED_URL = 'AQEC1423...';
// IF NOT, you can take the risk to insert your Slack URL here
// e.g. '/services/QWERTY/ASDFGHJ/zxYTinNLK';
@gjyoung1974
gjyoung1974 / splunk.yml
Last active March 17, 2018 15:22
Splunk on k8s
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: splunk
name: splunk
spec:
replicas: 1
selector:
@gjyoung1974
gjyoung1974 / aws_iam_access_key_age.py
Last active December 21, 2017 19:19
aws_iam_access_key_age.py
import boto3
import datetime
import time
# AWS Client>>
profile = 'some-profile'
boto3.setup_default_session(profile_name=profile)
client = boto3.client('iam')
# Array of users
package com.gyoung.auto.jwt.demo;
import java.io.IOException;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.util.Date;
import org.bouncycastle.util.encoders.Base64;
@gjyoung1974
gjyoung1974 / check_ossec.sh
Last active August 16, 2017 15:49
script to test ossec status
#!/usr/bin/env bash
# run local script functions remotely
function remote::run() {
# usage: remote::run "host" "includes" "commands"
# where "includes" is a list of functions to export to
# the remote host
[[ -n "$2" ]] && includes="$(declare -f $2);"
ssh -q -T $1 "$includes $3"
}
@gjyoung1974
gjyoung1974 / tokenize_6T4.sh
Created August 9, 2017 23:36
tokenize middle 6
#!/bin/bash
curl -s https://{some tenanant}.{some environment}.verygoodproxy.com/post \
-H "Content-type: application/json" \
-d '{"CCN": "'$1'"}' | jq --raw-output '.data' | jq --raw-output .CCN
@gjyoung1974
gjyoung1974 / clone-rds-db.sh
Created August 7, 2017 23:53
Clone an AWS RDS Instance
##########################################################################
# clone-rds-db.sh
#
# Usage:
# ./clone-rds-db.sh [instance_name]
#
# Creates a new RDS instance by cloning the latest production snapshot.
# More specifically, the following steps are performed:
# - Determine the snapshot id to use