Skip to content

Instantly share code, notes, and snippets.

View erriapo's full-sized avatar

Gavin (Saturn XXVIII) erriapo

  • Vancouver, Canada
View GitHub Profile
@erriapo
erriapo / RESET_USB_KERNEL_MODULE.md
Created April 1, 2022 19:26 — forked from planetceres/RESET_USB_KERNEL_MODULE.md
Restart/reset USB kernel module in Ubuntu 18.04 without rebooting
@erriapo
erriapo / base64_padding.md
Created March 31, 2020 18:53 — forked from perrygeo/base64_padding.md
Avoiding TypeError: Incorrect padding with Python's base64 encoding

Avoiding padding errors with Python's base64 encoding

>>> import base64
>>> data = '{"u": "test"}'
>>> code = base64.b64encode(data)
>>> code
'eyJ1IjogInRlc3QifQ=='
@erriapo
erriapo / slope_vs_starting.md
Created October 21, 2019 01:52 — forked from gtallen1187/slope_vs_starting.md
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

@erriapo
erriapo / track_data.py
Created June 4, 2019 22:24 — forked from dcramer/track_data.py
Tracking changes on properties in Django
from django.db.models.signals import post_init
def track_data(*fields):
"""
Tracks property changes on a model instance.
The changed list of properties is refreshed on model initialization
and save.
>>> @track_data('name')
@erriapo
erriapo / Exclude_tables.md
Created May 14, 2019 20:06 — forked from utek/Exclude_tables.md
Define ignored tables in alembic.ini

Add this in your ini file:

[alembic:exclude]
tables = spatial_ref_sys

In env.py:

def exclude_tables_from_config(config_):
    tables_ = config_.get("tables", None)

if tables_ is not None:

@erriapo
erriapo / ipdb.md
Created April 27, 2019 00:28 — forked from mono0926/ipdb.md
Debugging with ipython and ipdb
@erriapo
erriapo / bash.generate.random.alphanumeric.string.sh
Created November 22, 2018 21:43 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@erriapo
erriapo / assume_role.sh
Created October 30, 2018 03:16 — forked from woowa-hsw0/assume_role.sh
Start AWS CLI Session with MFA Enabled (+Yubikey)
#!/bin/bash
set -eu
umask 0022
if [[ $# -lt 1 ]]; then
echo "Usage: $0 role_name [AWS ACCOUNT NUMBER]" >&2
exit 1
fi
@erriapo
erriapo / web-servers.md
Created October 29, 2018 17:45 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000