Skip to content

Instantly share code, notes, and snippets.

View chrisswanda's full-sized avatar

Chris Swanda chrisswanda

View GitHub Profile
@chrisswanda
chrisswanda / WireGuard_Setup.txt
Last active May 2, 2024 01:13
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be
@chrisswanda
chrisswanda / smtp_icloud.py
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. https://support.apple.com/en-us/HT204397
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'] = 'sendfrom@mail.com'
msg['To'] = 'sendto@mail.com'
msg['Subject'] = 'Subject'
@chrisswanda
chrisswanda / Remove SSH key from GPG agent keyring.txt
Created May 12, 2020 11:59
Remove SSH key from GPG agent keyring
keys=$(gpg-connect-agent 'keyinfo --list' /bye | awk '{print $3}')
for key in $keys; do gpg-connect-agent "delete_key $key --force" /bye; done
@chrisswanda
chrisswanda / age_encryption_scripts.md
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 -> https://github.com/C2SP/C2SP/blob/main/age.md

And the current project in GitHub -> https://github.com/FiloSottile/age

Man page - https://htmlpreview.github.io/?https://github.com/FiloSottile/age/blob/master/doc/age.1.html

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
chrisswanda / contact_info.py
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
else:
strl = string
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZIc0chYJKwYBBAHaRw8BAQdAqFTi3sOPOWgleWpVrP1nZqkTkpOARaAAnTzI
kfAB0960JUNocmlzIFN3YW5kYSA8Y2hyaXMuc3dhbmRhQGdtYWlsLmNvbT6IlQQT
FgoAPRYhBDpRICammgJ8BaGr4dbHHO+nqtYwBQJkhzRyAhsBBQkDwmcABAsJCgQF
FQoJCAMFFgIDAQACHgECF4AACgkQ1scc76eq1jBKDQD/SB0jjX6m03dcX7MN6H92
knv7biiLaCrX5L+hvwDxNZcBAJIct9GOioiNmN6DP4aTW/kE9jRT0y3Xrliz2ekY
xcsCuDMEZIc1FxYJKwYBBAHaRw8BAQdA2UAhdHk4t3RKP/Frba6wTVO1R5u0ME9/
wUR3XP1JrI+IfgQYFgoAJhYhBDpRICammgJ8BaGr4dbHHO+nqtYwBQJkhzUXAhsg
BQkDwmcAAAoJENbHHO+nqtYwhkcBAMb1psMqXDyJ7bBe1zg0LvtV6d5yEY9Um2I6
{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Chris Swanda",
"label": "DevOps Dude",
"picture": "https://seccdn.libravatar.org/avatar/3af4117781e0d69367900432f45dbe41?size=128&default=mm",
"website": "https://olathewx.duckdns.org/about.html",
"email": "naphtha-decibel0t@icloud.com",
@chrisswanda
chrisswanda / AWS Datasync.md
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
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.
age_encrypt()
{
pub_key=$(cat ~/.config/age/pubkey.pub.age)
if [ -f $1 ] ; then
case $1 in
*.age) echo "'$1' is not a valid file" && return 1 ;;
@chrisswanda
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.
policies:
- name: call-Azure-webhook
resource: ec2
description: |