Skip to content

Instantly share code, notes, and snippets.

View DaneTheory's full-sized avatar
🏠
Working from home

Branden Dane DaneTheory

🏠
Working from home
View GitHub Profile
@daper
daper / backup.sh
Created November 18, 2018 19:15
Shell Only S3 Upload Script with Multipart support. Requirements: openssl, curl. Optional: gnu-parallel.
#!/bin/sh
# Author: daper <david@daper.email>
# Description: Shell Only S3 Upload Script with Multipart support.
# Requirements: openssl curl
# Optional: gnu-parallel
# Full path to this script.
# This is needed when using gnu-parallel.
# Please set-up manually.
SCRIPT="$(pwd)/backup.sh"
@brockers
brockers / aws_bash_setup.sh
Created November 9, 2018 20:45
AWS Bashrc Profile
# AWS Scripting functionality
#######################################################
if type "aws" > /dev/null; then
complete -C aws_completer aws;
fi
AWSCONFPATH="$HOME/.aws/config"
if [ -f "$AWSCONFPATH" ]; then
export AWS_ACCESS_KEY_ID=$(awk -F "=" '/aws_access_key_id/ {print $2}' $HOME/.aws/config)
export AWS_SECRET_ACCESS_KEY=$(awk -F "=" '/aws_secret_access_key/ {print $2}' $HOME/.aws/config)
@leechunhoe
leechunhoe / FileUpload.js
Last active November 9, 2022 15:36
Minimal file upload React.js component
import React, { Component } from 'react';
const S3 = require('aws-sdk/clients/s3');
const AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: [Your AWS access key ID (from ~/.bashrc)],
secretAccessKey: [Your AWS secret access key (from ~/.bashrc)]
});
class FileUpload extends Component {
// 'use strict'
require("dotenv").config();
const express = require("express");
const router = express.Router();
const DOCUMENT = require("../models/Document");
const multer = require("multer");
var AWS = require("aws-sdk");
// Multer ships with storage engines DiskStorage and MemoryStorage
// And Multer adds a body object and a file or files object to the request object. The body object contains the values of the text fields of the form, the file or files object contains the files uploaded via the form.
@thomijasir
thomijasir / setup_ubuntu_18_04.sh
Last active February 26, 2019 14:37
Auto Install Application Ubuntu 18.04 Bionic
## Install Requiriment And update System
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y install sudo nano git net-tools sudo wget curl bash-completion
sudo apt-get -y install software-properties-common dirmngr
sudo apt-get -y install apt-transport-https lsb-release ca-certificates
sudo apt-get -y install software-properties-common
## Update First
@dac73
dac73 / s3.sh
Last active December 10, 2018 04:57
aws cli
# get latest objects from S3 bucket
aws s3api list-objects --bucket {S3-bucket-name} --query "Contents[?LastModified>=\`$(date +%Y-%m-%d)\`][]"
@simonwhatley
simonwhatley / index.js
Last active December 2, 2018 21:46
Uploading files to AWS S3 using NodeJS
const AWS = require('aws-sdk');
const fs = require('fs');
const path = require('path');
//configuring the AWS environment
AWS.config.update({
accessKeyId: "AWS_ACCESS_KEY",
secretAccessKey: "AWS_SECRET_ACCESS_KEY"
});
@vicly
vicly / aws_decrypt.sh
Created September 23, 2018 23:40
[AWS encrypt and decrypt] #AWS #Bash
#!/bin/bash
set -euf -o pipefail
usage() {
echo "Usage: $0 -e [dev|test|preprod|prod] -t [encrypted text in base64]" 1>&2;
exit 1;
}
[ $# -eq 0 ] && usage
@AnthonyWharton
AnthonyWharton / automatedManualCertbotRenewal.sh
Last active April 12, 2024 02:23
FreeDNS (afraid.org) Cerbot/Let's Encrypt Manual Automation Script
#!/bin/bash
# Copyright 2018, Anthony Wharton
# Single script that can be called that generates certificates using the
# certbotFreeDNSAuthHook.sh and certbotFreeDNSCleanupHook.sh scripts.
# This should be used as guidence of my usage, and changed to your needs. Note
# the generic `/path/to/...` and `DOMAIN.COM`, which should be replaced with
# your script location and domain respectively. In addition, for this to be
# used on a live system, one must remove the `--dry-run` flag.
@kmcquade
kmcquade / _aws_scripts.md
Created September 9, 2018 19:56
Miscellaneous useful scripts with AWS

List:

  • export-aws-creds.py
    • Simple script that parses the ~/.aws/credentials file and creates the export command needed for pumping your AWS creds to command line

aws-secrets-send.sh and aws-secrets-get.sh

  • Used for grabbing secrets from S3 encrypted at the object level with KMS.
  • Easy to copy + paste or include in your repo when you have to use Ec2 userdata + IAM roles to download KMS-encrypted objects from S3
  • Based on this github repo but without the built-in options to create buckets and keys. This limits the capabilities of the script in a good way.