Skip to content

Instantly share code, notes, and snippets.

@briceburg
briceburg / aws-profiles.sh
Last active February 5, 2025 15:47
Configure shell completions for activating AWS_PROFILE and optionally refreshing its sso-session (if it expires in 2 hours or less)
# add the bellow blocks to your shell startup files (~/.bashrc || ~/.zshrc &c.)
# you will now have awsp-<profile_name> tab completions for activating configured profiles.
_aws-set-profile(){
echo "activating aws profile: $1" >&2
export AWS_PROFILE="$1"
local sso_session="$(aws configure get sso_session 2>/dev/null)"
if [[ -n "$sso_session" ]]; then
local expires=$(aws configure export-credentials | jq -r '.Expiration')
if [[ -z "$expires" || $(gdate --date "$expires" +'%s') -lt $(gdate --date "+2 hours" +'%s') ]]; then
echo "refreshing sso session" >&2
import logging
from celery.app.defaults import DEFAULT_TASK_LOG_FMT, DEFAULT_PROCESS_LOG_FMT
class CeleryTaskFilter(logging.Filter):
def filter(self, record):
return record.processName.find('Worker') != -1
@lopezjurip
lopezjurip / script.sh
Created September 25, 2016 02:08
Github full code review
# Create empty branch.
git checkout --orphan review
git rm -rf .
git commit --allow-empty -m "Create empty branch"
git push --set-upstream origin review
# Create `project` branch from `master` current state.
git checkout -b project
git merge master --allow-unrelated-histories
git push --set-upstream origin project