Skip to content

Instantly share code, notes, and snippets.

View excenter's full-sized avatar

Andrew Batz excenter

View GitHub Profile
@nmarley
nmarley / dec.py
Last active May 29, 2024 06:01
AWS KMS encryption/decryption using Python/Boto3
import boto3
import base64
if __name__ == '__main__':
session = boto3.session.Session()
kms = session.client('kms')
encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw=='
binary_data = base64.b64decode(encrypted_password)
@theburningmonk
theburningmonk / janitor-lambda.js
Last active September 29, 2021 14:36
Janitor Lambda function
'use strict';
const _ = require('lodash');
const co = require('co');
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda({ apiVersion: '2015-03-31' });
let functions = [];
let listFunctions = co.wrap(function* () {
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@briceburg
briceburg / Dockerfile.fails
Created March 30, 2016 22:17
docker - example adding www-data user to alpine images
FROM nginx:alpine
# stock verison from php:alpine image
# ensure www-data user exists
RUN set -x \
&& addgroup -g 82 -S www-data \
&& adduser -u 82 -D -S -G www-data www-data
# 82 is the standard uid/gid for "www-data" in Alpine
# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
@corburn
corburn / CSP.md
Last active September 20, 2023 12:55 — forked from xrstf/letsencrypt.md
Nginx server notes

The following is from scotthelme.co.uk

Content Security Policy

with Content Security Policy (CSP) enabled(and a browser that supports it(http://caniuse.com/#feat=contentsecuritypolicy), you can tell the browser that it can only download content from the domains you explicitly allow http://www.html5rocks.com/en/tutorials/security/content-security-policy/ https://www.owasp.org/index.php/Content_Security_Policy I need to change our application code so we can increase security by disabling 'unsafe-inline' 'unsafe-eval'

@alexniver
alexniver / using gvm.md
Last active February 20, 2018 20:30
using gvm

install

bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

using golang version 1.5.1, golang 1.5+ need 1.4 environment

gvm install go1.4
gvm use go1.4
gvm install go1.5.1
@feelinc
feelinc / UploadDirS3.py
Last active May 15, 2024 15:02
Upload folder contents to AWS S3
#!/usr/bin/python
import os
import sys
import boto3
# get an access token, local (from) directory, and S3 (to) directory
# from the command-line
local_directory, bucket, destination = sys.argv[1:4]
@kjbrum
kjbrum / bash_profile.sh
Last active October 18, 2023 15:36
My personal bash profile
#---------------------------------------------------------------------------------------------------------------------------------------
#
# Author: Kyle Brumm
# Description: File used to hold Bash configuration, aliases, functions, completions, etc...
#
# Sections:
# 1. ENVIRONMENT SETUP
# 2. MAKE TERMINAL BETTER
# 3. FOLDER MANAGEMENT
# 4. MISC ALIAS'
@simon04
simon04 / m4a2ogg
Created February 15, 2015 17:39
Converts m4a files to Ogg Vorbis using ffmpeg
#!/bin/bash
# Author: Simon Legner <Simon.Legner@gmail.com>
convert () {
in="$1"
out="${in%.m4a}.ogg"
ffmpeg -i "$in" \
-acodec libvorbis -aq 4 -vn -ac 2 \
-map_metadata 0 \
"$out"
@joohee
joohee / s3fs.sh
Created October 20, 2014 00:55
s3fs mount/umount
#!/bin/sh
echo "mount"
echo "s3fs [bucketname] [directory] -ouse_cache=/tmp -o allow_other"
echo "unmount"
echo "fusermount -u [directory]"
#echo "pkill -9 -f s3fs"