Skip to content

Instantly share code, notes, and snippets.

View huntie's full-sized avatar

Alex Hunt huntie

View GitHub Profile
@huntie
huntie / unpack_module.py
Created May 31, 2018 10:42
A small reflection utility to access public module members as a dict
def unpack_module(module) -> dict:
"""
Return the members of an imported package or module explicitly exported
using __all__.
"""
return {k: module.__dict__[k] for k in module.__dict__.get('__all__', [])}
@huntie
huntie / certbot.md
Last active March 1, 2018 17:42
Issue and automate renewal of SSL certificates with Let's Encrypt using Certbot

Install Certbot and register Let's Encrypt account:

add-apt-repository ppa:certbot/certbot
apt update
apt install certbot
certbot register

Issue new SSL certificates for each host:

certbot certonly --webroot -w /var/www/alexhunt.io/ -d alexhunt.io -d www.alexhunt.io

@huntie
huntie / KeyGenerateCommand.php
Last active July 19, 2016 13:13
APP_KEY generation command for Lumen, adapted from Illuminate\Foundation\Console\KeyGenerateCommand
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class KeyGenerateCommand extends Command
{
/**
* The name and signature of the console command.
@huntie
huntie / keybase.md
Last active June 6, 2016 13:05
Keybase GitHub identity

Keybase proof

I hereby claim:

  • I am huntie on github.
  • I am huntie (https://keybase.io/huntie) on keybase.
  • I have a public key whose fingerprint is 144D 5AFF A2FB 93C3 167B 5B0C 7B78 B3A2 DCC8 FF93

To claim this, I am signing this object:

@huntie
huntie / miner.py
Last active November 10, 2015 16:22
Challenge to find permutations of words within a scrambled text file
text = open('scrambled.txt', 'r').read()
words = ['miner', 'willy', 'andre', 'jet', 'set', 'bug', 'byte']
def permute(string):
result = []
if len(string) == 1:
result = [string]
else:
for i, char in enumerate(string):
@huntie
huntie / print.css
Created June 12, 2014 12:07
Show link addresses alongside titles in a printed webpage
@media print {
a:after {
/* Display link address for accessibility */
content: ' [' attr(href) '] ';
}
}