Skip to content

Instantly share code, notes, and snippets.

View papes1ns's full-sized avatar
🛹

Nathan Papes papes1ns

🛹
View GitHub Profile
@papes1ns
papes1ns / dexec.sh
Created May 17, 2023 02:15
dexec.sh
#!/usr/bin/env bash
set -eu # do not proceed on error
if [ $# -lt 1 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
cat <<EOF
Quick command to get a shell inside a running docker container.
Usage: dexec [container_name] [command]
@papes1ns
papes1ns / ecs_run_task_with_overrides.sh
Created March 28, 2022 12:55
ECS run task with overrides
#!/usr/bin/env bash
# step 1: define the AWS parameters to target the latest task definition for an
# ECS service and build the parameter to override the default container command.
profile=[your-profile]
region=[your-region]
cluster=[your-cluster]
service=[your-cluster-service]
cmd=$(cat <<EOF
{"containerOverrides": [
@papes1ns
papes1ns / gdpr_security.rb
Last active March 20, 2022 13:58
Adds hashing and encryption capabilities to ActiveRecord models.
# Nathan Papes 2020
#
# Adds hashing and encryption capabilities to ActiveRecord models.
# This concern was built to conform with GDPR requirements.
module GDPR_Security
extend ActiveSupport::Concern
class_methods do
# Adds the getters and setters for encryting and decrypting attributes.
# For example:
@papes1ns
papes1ns / sshec2.sh
Last active January 27, 2020 18:22
SSH into the EC2 host running a task for your ECS service
#!/bin/bash
set -eu # do not proceed on error
if [ $1 = "help" ] || [ $1 = "-h" ] ; then
cat <<EOF
echo "Usage: $0 [--profile profile] [--region region] [--key key] [--user user] [--port port] [--ip-type public|private] [--ip ip] [cluster] [service]"
--profile aws profile, defaults to 'default'
--region aws region, defaults to 'us-east-1'
flag_defs = [{
:name => "member1",
:position => 0,
:value => true
},
{
:name => "member2",
:position => 1,
:value => true
},