This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This will block users that are not root from accessing ec2 metadata | |
# Prevents users from grabbing the instance credentials | |
iptables -A OUTPUT -m owner ! --uid-owner root -d 169.254.169.254 -j DROP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -re -f lavfi -i 'testsrc[out0];sine[out1]' \ | |
-c:v libx264 -pix_fmt yuv420p -profile:v main \ | |
-preset veryfast -x264opts "nal-hrd=cbr:no-scenecut" \ | |
-minrate 3000 -maxrate 3000 -g 60 -c:a aac -b:a 160k \ | |
-ac 2 -ar 44100 -f flv \ | |
rtmps://$INGEST_ENDPOINT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -f lavfi -i 'testsrc[out0];sine[out1]' -t 30 -pix_fmt yuv420p colorbars_tone.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check for latest release: https://github.com/github/codeql-cli-binaries/releases | |
_version='v2.4.1' | |
_arch='osx' | |
_zip_url="https://github.com/github/codeql-cli-binaries/releases/download/${_version}/codeql-${_arch}64.zip" | |
_dir='codeql-home' | |
_cores=2 | |
pushd "${HOME}" || exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get open network connections | |
lsof -a -i4 -i6 -itcp | |
# Get listening ports | |
netstat -tunlp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./get_bucket_byprefix.sh "someprefix" | |
_prefix="${1}" | |
aws s3api list-buckets --query "Buckets[?starts_with(Name,'${_prefix}')].Name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./ssm_local.sh i-xxxxxxxxxx 80 | |
_instance_id="${1}" | |
_instance_port="${2}" | |
aws ssm start-session --target "${_instance_id}" \ | |
--document-name AWS-StartPortForwardingSession \ | |
--parameters "{\"portNumber\":[\"${_instance_port}\"],\"localPortNumber\":[\"9000\"]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_video_file="${1}" | |
ffmpeg -i $_video_file -vf palettegen pal.png | |
ffmpeg -i $_video_file -i pal.png -lavfi paletteuse=bayer_scale=4:dither=bayer -r 18 video.gif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare -r SOME_JSON_FILE="/path/to/json/file.json" | |
# Read a key from a file. | |
# Usage: _key_value=$(_read_json_key "key") | |
function _read_json_key() { | |
local -r _key="${1}" | |
jq --arg key "${_key}" -r '.[$key]' "${SOME_JSON_FILE}" | |
} | |
# Writes a json key into an existing file without overwriting. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The action we want to test | |
_action="s3:GetObject" | |
# The JSON you want to convert to a string | |
_json_to_convert='{ "Version": "2012-10-17","Statement": [{"Effect": "Allow","Action": "*","Resource": "*"}]}' | |
# Your resource arn goes here | |
_resource_arn="arn:aws:s3:::${_some_s3_bucket}/${_some_prefix}/*" | |
# This command will format the json policy as a string for the cli to use | |
# echo ${_json_to_convert} | jq '[.|tostring]' | |
# But we will send it to a fifo with '<()' instead of creating a json file every time |
NewerOlder