Skip to content

Instantly share code, notes, and snippets.

@ashemedai
ashemedai / awscli.sh
Last active November 24, 2022 12:21
AWS CLI v2 installer/update script
#!/bin/sh
AWSCLI_DIST="awscliv2.zip"
LOCAL_BIN_DIR="${HOME}/.local/bin"
LOCAL_SHARE_DIR="${HOME}/.local/share/aws"
V2_SHARE_DIR="${LOCAL_SHARE_DIR}/v2"
if [ -z "$(which curl)" ] || [ -z "$(which unzip)" ]; then
echo "Please make sure curl and unzip are installed"
exit 1
@fuxingloh
fuxingloh / app.js
Last active February 24, 2023 16:16
How to use express.js and passport.js with G Suite SAML Apps SSO
const express = require('express')
const SamlStrategy = require('passport-saml').Strategy
const passport = require('passport')
const cookieSession = require('cookie-session')
const cookieParser = require('cookie-parser')
// Create express instance
const app = express()
@halberom
halberom / extras.py
Last active November 8, 2023 16:23
ansible - example of merging lists of dicts
# ansible_plugins/filter_plugins/extras.py
def merge_dicts(value, dict1):
# return a merged dict
result = {}
result = value
result.update(dict1)
return result
def merge_lists_of_dicts(list1, list2):
# return a merged list

Production Blue-Green Deployment Pattern

came up during IRIS call with Zac, Joel, Julian & Robb - This is Robb's write-up on the matter.

  1. Blue-Green deployment: two Production ASGs & ELBs
  • only one is live at any time (Route53 Alias)
  • standby ASG can be deployed-to (rollforward or rollback), warmed-up (scaling, caching ,etc), and verified (smoke tests, etc. aginst standby.us-east-1.iris.tv) BEFORE being made live
  • Route53 API [ChangeResourceRecordSets] are transactional
  • Post-swap, the newly standby ASG can be updated to 0 desired instances (min and max = 0 too).
  • DNS changing is how AWS Elastic Beanstalk works too (SWAP CNAME API call).
@woloski
woloski / auth0.py
Last active June 14, 2017 21:12
this shows a very simple bare bones example of authenticating with Auth0 using standard python libraries
import webapp2
import urllib2
import urllib
import json
## CHANGE THIS
CLIENT_ID = "vYPeq7LGf1utg2dbDlGKCwGKgy94lPH0"
CLIENT_SECRET = "DLQ5dWkNMwPlUWo2jqVkbG1PFyeMvV60HEJaW0FioeI4ZxGaAW73BiqRBZmRk29v"
DOMAIN = "contoso.auth0.com"
CALLBACK_URL = "http://localhost:8080/callback"
@afresh1
afresh1 / find_networks.sh
Last active July 16, 2018 14:30
A script to find and connect to known wifi networks on OpenBSD. Works for me on my iwn card in my laptop
#!/bin/sh
# find_network.sh - An OpenBSD Wireless Network configurator
# Looks for available networks listed at the end of the script
# Use this by adding "!/path/to/find_network.sh \$if" to your wlan hostname.if
if=$1
if [ -z "$if" ]; then
echo "Usage: $0 interface" >&2
exit 2;
fi
@mnot
mnot / RSS.py
Created October 29, 2009 12:48
RSS.py: work with RSS channels as data structures
#!/usr/bin/env python
"""
RSS.py
Classes for working with RSS channels as arbitrary data structures.
Requires Python 2.2 or newer and PyXML 0.7.1 or newer.
ChannelBase - Base class for RSS Channels.
CollectionChannel - RSS Channel modeled as a URI-per-entry
@endolith
endolith / Has weird right-to-left characters.txt
Last active March 28, 2024 04:56
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶