Skip to content

Instantly share code, notes, and snippets.

@mtbdeano
mtbdeano / split_horizonator.py
Created June 29, 2015 21:10
Simple python script to keep Amazon Route 53 public/private split horizon DNS domains in sync
import boto.route53
import boto.ec2
import pprint as pp
def match_domain(domain, region="us-east-1"):
''' iterate through the public EIPs and make sure that if there is a `domain.com` entry for that EIP, it's private IP is also mapped in the private `domain.com`
'''
r53 = boto.route53.connect_to_region(region)
ec2 = boto.ec2.connect_to_region(region)
@volure
volure / SSH: Self Sign Postfix
Last active October 25, 2024 21:10
Create a Self Signed Postfix Certificate
# copied from https://www.e-rave.nl/create-a-self-signed-ssl-key-for-postfix
openssl genrsa -des3 -out mail.domain.tld.key 2048
chmod 600 mail.domain.tld.key
openssl req -new -key mail.domain.tld.key -out mail.domain.tld.csr
openssl x509 -req -days 365 -in mail.domain.tld.csr -signkey mail.domain.tld.key -out mail.domain.tld.crt
openssl rsa -in mail.domain.tld.key -out mail.domain.tld.key.nopass
mv mail.domain.tld.key.nopass mail.domain.tld.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
chmod 600 mail.domain.tld.key
# http://qiita.com/uchiko/items/f6b1528d7362c9310da0
function peco-select-history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(\history -n 1 | \
eval $tac | \
@ajsharp
ajsharp / migrate-route53-dns
Last active July 3, 2023 18:35
This script makes it very easy to migrate an entire DNS zone from one AWS Route53 zone to another. This script expects you to have downloaded the old zone file via the AWS CLI to a json file called DOMAIN.zone.json. It uses the AWS CLI to perform the request, so make sure that your credentials are properly configured.
#!/usr/bin/env ruby
require 'json'
# This is the json output of the old zone, fetched using the AWS CLI.
zone = JSON.parse(File.read('DOMAIN.zone.json'))['ResourceRecordSets']
new_zone_id = 'NEW_ZONE_ID'
# We don't want to migrate the SOA and NS records from the old zone.
@samukasmk
samukasmk / encrypt_decrypt_salt.sh
Created February 2, 2015 14:16
Encrypt and decrypt a string (With SALT Password - AES-128-cdc)
# ENCRYPTING WITH PRE-DEFINED (SALT PASSWORD)
$ echo 'this is my password' | openssl enc -aes-128-cbc -a -salt -pass pass:HereIsMySalt
U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl
# DECRYPTING WITH PRE-DEFINED (SALT PASSWORD)
$ echo 'U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl' | openssl enc -aes-128-cbc -a -d -salt -pass pass:HereIsMySalt
this is my password
# EXAMPLE OF DECRYPTING WITH WRONG SALT PASSWORD, GENERATING ERROR
$ echo 'U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl' | openssl enc -aes-128-cbc -a -d -salt -pass pass:PassingWrongSalt
@steve-jansen
steve-jansen / README.md
Last active December 13, 2024 23:29
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@phybros
phybros / update-route53.sh
Last active February 12, 2024 00:07
BASH Script to keep Route53 updated with your current external IP address
#!/bin/bash
# (optional) You might need to set your PATH variable at the top here
# depending on how you run this script
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Hosted Zone ID e.g. BJBK35SKMM9OE
ZONEID="enter zone id here"
# The CNAME you want to update e.g. hello.example.com
@soarez
soarez / ca.md
Last active July 27, 2025 23:20
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@eerien
eerien / aws_rss_feeds.xml
Last active August 9, 2025 21:18
AWS RSS Feeds OPML includes AWS Status, AWS Forum Announcements, AWS Blogs, AWS Partners, AWS News, AWS Release Notes and AWS Security Bulletins
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>AWS RSS Feeds</title>
</head>
<body>
<outline title="AWS Status" text="AWS Status">
<outline text="Amazon Mobile Analytics (N. Virginia) Service Status" title="Amazon Mobile Analytics (N. Virginia) Service Status" type="rss" xmlUrl="http://status.aws.amazon.com/rss/analytics-us-east-1.rss" htmlUrl="http://status.aws.amazon.com/" rssfr-favicon="http://status.aws.amazon.com/favicon.ico"/>
<outline text="Amazon AppStream (N. Virginia) Service Status" title="Amazon AppStream (N. Virginia) Service Status" type="rss" xmlUrl="http://status.aws.amazon.com/rss/appstream-us-east-1.rss" htmlUrl="http://status.aws.amazon.com/" rssfr-favicon="http://status.aws.amazon.com/favicon.ico"/>
<outline text="Auto Scaling (Tokyo) Service Status" title="Auto Scaling (Tokyo) Service Status" type="rss" xmlUrl="http://status.aws.amazon.com/rss/autoscaling-ap-northeast-1.rss" htmlUrl="http://status.a
@niksumeiko
niksumeiko / git.migrate
Last active November 4, 2025 19:07
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.