Skip to content

Instantly share code, notes, and snippets.

View shawnsi's full-sized avatar

Shawn Siefkas shawnsi

View GitHub Profile
@shawnsi
shawnsi / README.md
Last active March 11, 2016 16:53
Apex Record Redirects

Apex Record Redirects

An apex (or root) record of a zone cannot be a CNAME by specification. This has implications for domains that try to integrate with virtually any cloud platform (AWS, Azure, Heroku, etc.). A common pattern to mitigate this issue is to perform a HTTP 301 redirect from the apex record to a subdomain (usually www.domain.com).

On the other hand, using a single cloud provider for DNS and underlying infrastructure may yield proprietary solutions. For example, AWS provides a Route 53 alias record which can be used at the zone apex.

Alexa Script

To understand the prevalence of the apex redirect pattern this script will test the top 1000 Alexa rank domains (as of 3/11/16).

@shawnsi
shawnsi / README.md
Last active March 11, 2022 06:54
Pacman Automatic Updates

Background

I may have let Arch go months without updates before. Its not advisable to apply them on a schedule either.

Solution

Providing regular prompts to apply updates seems like the best solution.

Schedule Download of Packages

This cronjob will download packages and cache locally. Put into root's crontab or run via sudo.

@shawnsi
shawnsi / EMR.ipynb
Last active September 19, 2016 18:01
EMR vs Hadoop
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shawnsi
shawnsi / food-nouns.py
Last active November 17, 2016 17:55
Food Nouns
#!/usr/bin/env python
import requests
from nltk import download, pos_tag, word_tokenize
download('punkt')
download('averaged_perceptron_tagger')
response = requests.get('http://www.textfiles.com/food/food')
text = word_tokenize(response.text)
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.poisson = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
var Process = require('./lib/Process');
// Raw sampling function
exports.sample = require('./lib/sample');
// Semantic version, useful for inspection when v
@shawnsi
shawnsi / README.md
Created January 6, 2020 20:45
Delete All S3 Object Versions

Delete All S3 Object Versions

Use this script to delete all object versions in a S3 bucket. For very large object version counts it may be more effective to use Object Lifecycle Management instead to expire versions.

Usage

python delete-object-versions.py (s3-bucket-name)
@shawnsi
shawnsi / stackset-waiter.py
Created August 7, 2020 19:11
Stack Set Waiter Model
import botocore
_model = botocore.waiter.WaiterModel({
'version': 2,
'waiters': {
'StacksetOpComplete': {
'delay': 30,
'operation': 'DescribeStackSetOperation',
'maxAttempts': 50,
'description':