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
https://askubuntu.com/questions/623038/rotate-nohup-output
http://jdebp.eu./FGA/do-not-use-logrotate.html
@erriapo
erriapo / gist:3211e6e08849d505ba83417cf9a3e261
Created February 22, 2019 20:41
Generate a self-signed TLS cert with subjectAltNames wildcards
$ cat openssl.cnf
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
x509_extensions = v3_ca
[ req_distinguished_name ]
@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
@erriapo
erriapo / gist:c954fb6ac4cbd6f8768a63344f47ac9a
Created November 21, 2018 20:23
Go lang implementation of python's range function
// https://docs.python.org/3/library/functions.html#func-range
package main
import (
"fmt"
)
type Range struct {
Step int32
Max int32