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
@libert-xyz
libert-xyz / cfn-hup.yaml
Created June 4, 2020 01:26
cfn-hup example
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudFormation Sample Template for CFN Init
Parameters:
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
Type: AWS::EC2::KeyPair::KeyName
ConstraintDescription: must be the name of an existing EC2 KeyPair.
LatestLinuxAmiId:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
# 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 / 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']
def duplSets(l):
l = set(l)
print (l)
#Libert R Schmidt
# http://www.practicepython.org/exercise/2014/05/15/14-list-remove-duplicates.html
def duplLoop(l):
newL=[]
@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 R Schmidt
#rschmidt@libert.xyz
#Practice Python http://www.practicepython.org/exercise/2014/04/02/09-guessing-game-one.html
import random
def start_game():
num = int(input("Guess the number between 1 and 9 --> "))
game(num)