Skip to content

Instantly share code, notes, and snippets.

View chrisswanda's full-sized avatar

Chris Swanda chrisswanda

View GitHub Profile
chrisswanda / AWS
Last active March 6, 2023 13:51
AWS Datasync between two S3 buckets across two different AWS accounts

What is it?

DataSync fully automates the data transfer. It comes with retry and network resiliency mechanisms, network optimizations, built-in task scheduling, monitoring via the DataSync API and Console, and CloudWatch metrics, events and logs that provide granular visibility into the transfer process. DataSync performs data integrity verification both during the transfer and at the end of the transfer.

DataSync provides end-to-end security, and integrates directly with AWS storage services. All data transferred between the source and destination is encrypted via TLS, and access to your AWS storage is enabled via built-in AWS security mechanisms such as IAM roles. DataSync with VPC endpoints are enabled to ensure that data transferred between an organization and AWS does not traverse the public internet, further increasing the security of data as it is copied over the network.

How to copy between two different AWS Accounts and S3 buckets

You will need to define a source account and bucket, and a dest

chrisswanda / age_functions.txt
Created October 4, 2022 14:16
Adding age functions in my bash_profile
I banged rocks together and came up with this. I was needing a quick way to do age encryption/decryption for various files.
Dropped this in my ~/.bash_profile.
pub_key=$(cat ~/.config/age/
if [ -f $1 ] ; then
case $1 in
*.age) echo "'$1' is not a valid file" && return 1 ;;
chrisswanda / Azure-webhook.yml
Created July 19, 2022 14:24
Cloud Custodian (c7n) to Azure Teams Incoming Webhook
# Unfortunately we use Teams and I needed a way to deliver a payload to an incoming webhook via Lambda for
# various c7n things.
# Below is just an example.
- name: call-Azure-webhook
resource: ec2
description: |
chrisswanda /
Last active September 12, 2023 02:05
Age encryption scripts

I've slowly been converting various processes and encryption schemes over to age, versus using PGP to store encrypted data at rest and sending of encrypted payloads to other users/machines.

If you are not familiar with age, see the specs here ->

And the current project in GitHub ->

Man page -

Since version 1.0.0 is out and is considered release, hopefully we will start seeing some cool projects using age for encryption, and hopefully some mobile apps, slick UIs, etc... will soon follow.

chrisswanda /
Last active June 14, 2023 19:44
How you can contact me
import os
import sys
import numpy
import string
if sys.version > '3':
strl = str
strl = string
chrisswanda /
Last active July 4, 2021 10:00
Cook perfect rice in your instant pot
'''This stupid little script I use all the time to make perfect rice in my instant pot.
I also have a Siri Shortcut in the event that I'm near my HomePod, or other Apple devices. Just tell Siri, Cook Rice.
It makes the perfect white rice in your pressure cooker or instant pot.
How I use it, is to use a kitchen scale to weigh my inner pot (which is always 1102 grams,
but added in the formula in the event I find myself at someone else's house and need to make some perfect rice).
I then weigh my rice individually to get the weight. I then wash my rice in multiple changes of water until it runs clear.
"meta": {
"theme": "elegant"
"basics": {
"name": "Chris Swanda",
"label": "DevOps Dude",
"picture": "",
"website": "",
"email": "",
chrisswanda /
Last active March 20, 2021 13:48
Send daily emails of crypto prices from
from requests import Request, Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
import json
import smtplib
''' you will need an API from '''
''' let's get Bitcoin prices '''
BTCurl = ''
chrisswanda /
Last active January 24, 2024 08:53
Python script to send mail via Apple's iCloud. Be sure to setup an app specific password for and do not use or expose your iCloud password.
import smtplib
#email.mime.multipart is specific to python3
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
msg = MIMEMultipart()
msg['From'] = ''
msg['To'] = ''
msg['Subject'] = 'Subject'