Skip to content

Instantly share code, notes, and snippets.

@alexhayes
alexhayes / dumpnested.py
Created May 2, 2016 08:37
Django management command to dump objects to JSON with all nested relations included.
# -*- coding: utf-8 -*-
"""
Dump out objects and all nested associations.
"""
from __future__ import absolute_import, print_function, unicode_literals
import sys
from django.contrib.admin.utils import NestedObjects
from django.core import serializers
@alexhayes
alexhayes / Reaper DDP Creation, Verification & Burn.rst
Last active December 11, 2022 06:08
Reaper DDP Creation, Verification and Burn Instructions.

DDP Creation, Verification & Burn

DDP creation, verification & burn using Reaper, ddpinfo and ImgBurn.

Reaper

TLDR

@alexhayes
alexhayes / pyenv+direnv on OSX.md
Last active November 6, 2022 20:17
Awesomely easy virtualenvs on OSX using pyenv and direnv

Awesomely easy virtualenvs on OSX using pyenv and direnv

Never forget to activate that virtualenv or set that environment variable ever again...

Install

  1. Install pyenv

     brew install pyenv
    
@alexhayes
alexhayes / .multitailrc
Last active September 8, 2021 08:57
multitail python log formatting
colorscheme:python-log
cs_re_s:blue:[DEBUG|INFO|WARNING|CRITICAL|ERROR] ([a-z\.0-9\_]+):
cs_re_s:white,magenta,bold:(\sDEBUG\s)
cs_re:magenta:.*DEBUG.*
cs_re_s:white,green,bold:(\sINFO\s)
cs_re:green:.*INFO.*
cs_re_s:white,yellow,bold:(\sWARNING\s)
cs_re:yellow:.*WARNING.*
cs_re_s:white,red,bold:(\sCRITICAL\s)
cs_re:red:.*CRITICAL.*
@alexhayes
alexhayes / MapContextKeyToF20.plist
Last active August 26, 2021 22:39
~/Library/LaunchAgents/MapContextKeyToF20.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
This remaps the Context Key (between the right hand Alt and Control on a normal keyboard) to the F20 key.
See https://apple.stackexchange.com/a/398797/264061
Source is stored in https://gist.github.com/alexhayes/be6257459eb7a2dbc1e5b2baaebdac90
-->
<plist version="1.0">
@alexhayes
alexhayes / .direnvrc
Last active August 25, 2021 07:15
My custom .direnvrc
# See https://github.com/direnv/direnv/wiki/Python#-pyenv
use_flutter() {
PATH_add "$HOME/workspace/flutter/bin"
}
# Python using pyenv
#
# Usage:
# Install python with:
Lab-1: Cluster Creation
---------------------------
1. MSK Workshop link = https://amazonmsk-labs.workshop.aws/en/clustercreation.html
2. Use the following cloudformation template, download it on your laptop
https://github.com/vikasbajaj/msk-kafka-workshop/blob/master/msk-infra-and-kafka-clients/MSK-VPC-Clients.yaml
3. Make sure you are in running this lab in ap-southeast-2 (sydney) region
@alexhayes
alexhayes / SupervisordInstallationUbuntu12.04LTS.md
Last active April 7, 2020 14:20
Supervisord Installation on Ubuntu 12.04 LTS

Supervisord Installation on Ubutnu 12.04 LTS

There are a number of solutions for installing supervisord and automatically running it on Ubuntu - this is what worked for me (on multiple installations...).

Installation

Quick & Easy

sudo bash &lt; &lt;(curl https://gist.githubusercontent.com/alexhayes/814fd0d0f7020e918a95/raw/full-install.sh)
@alexhayes
alexhayes / ssl_puma.sh
Last active November 1, 2018 03:19 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ mkdir local
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
@alexhayes
alexhayes / .slate
Created January 22, 2018 01:27
My slate rc
# Move to
bind ;:cmd,alt,ctrl throw 0
bind .:cmd,alt,ctrl throw 1
# Resize on Top Screen
bind l:cmd,alt move screenOriginX,screenOriginY screenSizeX/2,screenSizeY 0
bind ;:cmd,alt move screenOriginX,screenOriginY screenSizeX,screenSizeY 0
bind ':cmd,alt move screenOriginX+screenSizeX/2,screenOriginY screenSizeX/2,screenSizeY 0
# Resize on Laptop Screen