Skip to content

Instantly share code, notes, and snippets.

View peacengell's full-sized avatar

peacengell peacengell

View GitHub Profile
@peacengell
peacengell / ConvertTo-SSMDocument.ps1
Created January 7, 2021 10:28 — forked from danwagoner/ConvertTo-SSMDocument.ps1
[Convert PS Script to SSM Document] Automatically generates the document json from provided script and saves the document in the documents folder. #powershell #ssm #aws
# Automatically generates the document json from provided script and saves the document in the documents folder.
param (
[Parameter(Mandatory=$True)]
[string]$ScriptPath,
[Parameter(Mandatory=$True)]
[string]$Description
)
$Prefix = @"
#!/bin/bash
SERVER_URL="$1"
KEY_WORD="$2"
SLEEP_TIME="$3"
if [ -z "$3" ]
then
SLEEP_TIME=50
@peacengell
peacengell / dockerlog_setup.sh
Created December 20, 2018 05:08 — forked from carlessanagustin/dockerlog_setup.sh
Docker log setup - apply: wget -O - https://goo.gl/x86FN9 | sudo bash
#!/usr/bin/env bash
# empty log file: echo "" > $(docker inspect --format='{{.LogPath}}' <container_name_or_id>)
# apply: wget -O - https://goo.gl/x86FN9 | sudo bash
FILEPATH=/etc/docker/daemon.json
cat << EOF > $FILEPATH
{
"log-driver": "json-file",
@peacengell
peacengell / logrotate_setup.sh
Created December 20, 2018 05:07 — forked from carlessanagustin/logrotate_setup.sh
Logrotate setup - apply: wget -O - https://bit.ly/2PkCV8J | sudo bash -s <LOGS_FOLDER> <FILENAME>
#!/usr/bin/env bash
LOGS_FOLDER=$1
FILENAME=$2
DEST_FOLDER=/etc/logrotate.d
cat << EOF > $DEST_FOLDER/$FILENAME
$LOGS_FOLDER/*.log {
rotate 7
size 100M
@peacengell
peacengell / proftpd.sh
Created December 20, 2018 05:06 — forked from carlessanagustin/TODO.sh
Install proftpd, create & delete ftp users (MUST BE RUN AS ROOT)
#!/usr/bin/env bash
# MUST BE RUN AS ROOT
usage_message(){
echo Usage options:
echo "1. Install proftpd: $0 -i <PASVADDR> <MIN_PORT> <MAX_PORT>"
echo "2. Create ftp user: $0 -c <FTPUSER> <FTPPASS>"
echo "3. Delete ftp user: $0 -d <FTPUSER>"
}
@peacengell
peacengell / ec2_info_retriever.py
Created September 9, 2018 17:55 — forked from dastergon/ec2_info_retriever.py
A basic boto3 based tool for retrieving information from running EC2 instances.
from collections import defaultdict
import boto3
"""
A tool for retrieving basic information from the running EC2 instances.
"""
# Connect to EC2
ec2 = boto3.resource('ec2')
@peacengell
peacengell / boto3_hands_on.md
Created August 24, 2018 09:54 — forked from iMilnb/boto3_hands_on.md
Programmatically manipulate AWS resources with boto3 - a quick hands on

boto3 quick hands-on

This documentation aims at being a quick-straight-to-the-point-hands-on AWS resources manipulation with [boto3][0].

First of all, you'll need to install [boto3][0]. Installing it along with [awscli][1] is probably a good idea as

  • [awscli][1] is boto-based
  • [awscli][1] usage is really close to boto's
@peacengell
peacengell / git_alias.md
Created July 20, 2018 05:57 — forked from thieryl/001_ansible _deep_dive.md
[Yesterday I learned...] Continous learning #general

Git Tips and tricks


01 - list you git configuration

thieryl@thieryl[09:52:44]: $ git config --list 
user.email=thiery.louison@redboxdigital.com
user.name=thiery louison
alias.aa=add --all
alias.bv=branch -vv
@peacengell
peacengell / cloudSettings
Created January 22, 2018 06:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-01-22T06:51:54.064Z","extensionVersion":"v2.8.7"}
@peacengell
peacengell / gist:e327fad57fd3a2914c40457b624384de
Created October 24, 2017 04:46 — forked from hummus/gist:8592113
aws cli + jq example
wget http://stedolan.github.io/jq/download/linux64/jq
aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \
"Name=instance-state-name,Values=running" \
| jq -r \
".Reservations[] | .Instances[] | .InstanceId" \
aws ec2 describe-volumes --filters \
"Name=status,Values=available" \
| jq -r ".Volumes[] | .VolumeId" \