Skip to content

Instantly share code, notes, and snippets.

Alex Hayes alexhayes

Block or report user

Report or block alexhayes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alexhayes
alexhayes / ssl_puma.sh
Last active Nov 1, 2018 — forked from tadast/ssl_puma.sh
localhost SSL with puma
View ssl_puma.sh
# 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
View .slate
# 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
@alexhayes
alexhayes / .direnvrc
Last active Jul 3, 2018
My custom .direnvrc
View .direnvrc
# See https://github.com/direnv/direnv/wiki/Python#-pyenv
use_python() {
local python_root=$HOME/.pyenv/versions/$1
load_prefix "$python_root"
if [[ -x "$python_root/bin/python3" ]]; then
layout python3
else
layout python
fi
@alexhayes
alexhayes / pyenv+direnv on OSX.md
Last active Feb 15, 2019
Awesomely easy virtualenvs on OSX using pyenv and direnv
View pyenv+direnv on OSX.md

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
    
View keybase.md

Keybase proof

I hereby claim:

  • I am alexhayes on github.
  • I am alexhayes (https://keybase.io/alexhayes) on keybase.
  • I have a public key whose fingerprint is 39B2 DA8A 524D 2835 5D99 6460 217F 3346 CF5D B9E9

To claim this, I am signing this object:

@alexhayes
alexhayes / npm-standalone-eslint-install.sh
Last active Jul 12, 2016
Standalone `npm` install for eslint/react/et al
View npm-standalone-eslint-install.sh
#!/bin/bash
npm install -g eslint babel-eslint eslint-config-standard-react eslint-config-standard eslint-plugin-promise eslint-plugin-standard eslint-config-standard eslint-plugin-flow-vars eslint-plugin-react
@alexhayes
alexhayes / dumpdata_by_id.py
Last active Jul 4, 2016
Django management command to dump out model instances and all nested associations
View dumpdata_by_id.py
# -*- 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 / dumpnested.py
Created May 2, 2016
Django management command to dump objects to JSON with all nested relations included.
View dumpnested.py
# -*- 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 Nov 7, 2018
Reaper DDP Creation, Verification and Burn Instructions.
View Reaper DDP Creation, Verification & Burn.rst

DDP Creation, Verification & Burn

DDP creation, verification & burn using Reaper, ddpinfo_ and ImgBurn_.

Reaper

TLDR

View ordered_dict_serializer.py
class OrderedDictSerializer(serializers.ListSerializer):
"""
django-rest-framework serializer that a list or queryset into an OrderedDict.
"""
def to_representation(self, data):
"""
OrderedDict of object instances -> OrderedDict of dicts of primitive datatypes.
"""
# Dealing with nested relationships, data can be a Manager,
You can’t perform that action at this time.