Skip to content

Instantly share code, notes, and snippets.

View rms1000watt's full-sized avatar

Ryan M Smith rms1000watt

View GitHub Profile
@rms1000watt
rms1000watt / install-golang-linux.sh
Created September 24, 2018 18:46
Install Go 1.11 on Linux
echo "Install Golang"
curl -o go1.11.linux-amd64.tar.gz https://dl.google.com/go/go1.11.linux-amd64.tar.gz
sudo tar -xvf go1.11.linux-amd64.tar.gz
sudo mv go /usr/local
rm go1.11.linux-amd64.tar.gz
echo "export GOROOT=/usr/local/go" >> /home/ubuntu/.bashrc
@rms1000watt
rms1000watt / ssm-provision.sh
Created September 18, 2018 18:42
Provision SSM via bash script
#!/usr/bin/env bash
set -e
echo "This script will provision AWS SSM that will be used for deployments.."
configure() {
echo
read -rp "Set value: $1 (y/n): " yn
@rms1000watt
rms1000watt / main.go
Created August 30, 2018 20:25
Clone Git Repo in Pure Go
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws/session"
@rms1000watt
rms1000watt / aws-err-code-conversion.go
Created August 2, 2018 15:11
Converting AWS Error code, checking if match
// https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/handling-errors.html
svc := s3.New(sess)
resp, err := svc.GetObject(&s3.GetObjectInput{
Bucket: aws.String(os.Args[1]),
Key: aws.String(os.Args[2]),
})
if err != nil {
// Casting to the awserr.Error type will allow you to inspect the error
@rms1000watt
rms1000watt / audit-file-linux-ausearch.sh
Created August 1, 2018 23:10
Audit who did what to a file on Linux with Ausearch
#!/usr/bin/env bash
# Courtesy of: https://www.cyberciti.biz/tips/linux-audit-files-to-see-who-made-changes-to-a-file.html
auditctl -w /etc/passwd -p war -k password-file
ausearch -f /etc/passwd -i
@rms1000watt
rms1000watt / turn-off-mcafee-ossec-on-rhel.sh
Created August 1, 2018 23:08
Turn off McAfee & OSSec on RHEL
#!/usr/bin/env bash
/var/ossec/bin/ossec-control start
/var/ossec/bin/ossec-control stop
/opt/isec/ens/threatprevention/bin/isectpdControl.sh stop
/opt/isec/ens/esp/bin/isecespdControl.sh stop
@rms1000watt
rms1000watt / openssl-self-signed-certs.sh
Last active July 26, 2018 00:01
OpenSSL Self Signed Certs
#!/usr/bin/env bash
openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -nodes
@rms1000watt
rms1000watt / pull-prs-from-github.sh
Last active July 24, 2018 22:57
Pull PRs From Github
#!/usr/bin/env bash
get-all() {
if [[ -z $GITHUB_ACCESS_TOKEN ]]; then
echo "ERROR: no GITHUB_ACCESS_TOKEN defined"
exit 1
fi
pages=(1 2 3 4 5 6 7 8)
@rms1000watt
rms1000watt / clean-docker-env.sh
Created July 19, 2018 14:04
Clean up docker env to free up space
#!/usr/bin/env bash
docker ps -aq | xargs docker stop -f
docker system prune -f
docker network prune -f
docker volume prune -f
docker image prune -f
docker images -aq | xargs docker image rm -f
@rms1000watt
rms1000watt / update-license-headers.sh
Created July 18, 2018 23:19
Update License Headers in a Directory
#!/usr/bin/env bash
GREP_STR="Copyright Veritone Corporation 2018. All rights reserved."
LICENSE_HASH="# Copyright Veritone Corporation 2018. All rights reserved.
# See LICENSE for more information.
"
LICENSE_SLASH="// Copyright Veritone Corporation 2018. All rights reserved.
// See LICENSE for more information.
"