Skip to content

Instantly share code, notes, and snippets.

View libert-xyz's full-sized avatar
🗽
/dev/urandom

Libert Schmidt libert-xyz

🗽
/dev/urandom
View GitHub Profile
# read more at: https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-public-parameters.html
# this will pickup the latest value of the parameter every time the template is run
# the parameter value must be the Key for that Parameter. Then CFN will retrieve the value
# this does not support SecureString SSM Parameter types
Parameters:
LatestLinuxAmiId:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
# obtain list with
@libert-xyz
libert-xyz / ebs_resize.sh
Last active June 26, 2020 16:18
Resize EBS storage from the EC2 itself (Amazon Linux AMI release 2018.03)
#!/bin/bash
# Specify the desired volume size in GiB as a command-line argument. If not specified, default to 20 GiB.
SIZE=${1:-20}
# Install the jq command-line JSON processor.
sudo yum -y install jq
# Get the ID of the envrionment host Amazon EC2 instance.
INSTANCEID=$(curl http://169.254.169.254/latest/meta-data//instance-id)
@libert-xyz
libert-xyz / vyprvpn_ec2.py
Created November 23, 2019 22:39
Launch 100 EC2 + EIP and install vyprVPN
import logging
import boto3
from botocore.exceptions import ClientError
import time
AMI='ami-0f93b5fd8f220e428'
SUBNET='subnet-8f5e56e7'
SG=['sg-0d5d78dc3b411252b']
REGION='us-east-2'
KEY='VyprVPN-us-east-2'
@libert-xyz
libert-xyz / eips-centos7
Created September 19, 2019 21:06
Multiple EIP in the same subnet (RHEL / Centos7)
https://www.internetstaff.com/multiple-ec2-network-interfaces-on-red-hat-centos-7/
@libert-xyz
libert-xyz / Dockerfile
Created August 20, 2019 20:36
Dockerfile to understand RUN , CMD and ENTRYPOINT
FROM alpine:3.10.1
RUN apk add --update /
python3 /
py-pip /
curl
##Example CMD exec form
#CMD ['python3','--version']
@libert-xyz
libert-xyz / audio.bash
Created September 7, 2018 03:38
audio.bash
#!/bin/bash
#ffmg = ffmpeg -i 2.5-2.mp3 -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 2.5-2-e.mp3
for i in $(ls *.mp3); do
#echo audio: $i
NAME=`echo "$i" | cut -d'.' -f1`
#!/bin/sh
# to use, copy this file into your .git/hooks folder in your git repo
# Rename the file to: pre-commit
# make sure to add execute permissions using: chmod +x .git/hooks/pre-commit
command -v pngcrush >/dev/null 2>&1 || {
echo "\033[1mPlease install pngcrush to reduce images size before commit\033[0m"
echo "Install pngcrush with the following:"
echo "\t \033[1mbrew install pngcrush\033[0m"
echo "OR"
echo "\t Site: \033[1m\033[4mhttp://pmt.sourceforge.net/pngcrush/\033[0m"
{
"AWSTemplateFormatVersion": "2010-09-09",
"Outputs": {
"CCRoleArn": {
"Value": {
"Fn::GetAtt": [
"CCRole",
"Arn"
]
}
@libert-xyz
libert-xyz / encrypt_password_to_dyndb.py
Created November 30, 2017 01:46 — forked from JohnPreston/encrypt_password_to_dyndb.py
Generates, encrypt and store password in DynamoDB
import base64
import uuid
import httplib
import urlparse
import json
import boto3
import string
import random
@libert-xyz
libert-xyz / s3PolicyPublic.json
Created November 20, 2017 02:44
grant access to every object in the bucket example
{
"Id": "Policy1397632521960",
"Statement": [
{
"Sid": "Stmt1397633323327",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::example/*",