Skip to content

Instantly share code, notes, and snippets.

Will Vaughn nackjicholson

Block or report user

Report or block nackjicholson

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
@nackjicholson
nackjicholson / arch_first_steps.org
Last active Nov 13, 2019
arch reinstall on t470s nvme0n1 device notes
View arch_first_steps.org

Enable system NetworkManager

systemctl enable NetworkManager
systemctl start NetworkManager
nmtui # terminal ui to activate and connect to wifi

Install zsh

View hbase_trouble.org

Restarting a dead service on a node

https://aws.amazon.com/premiumsupport/knowledge-center/restart-service-emr/

hbase regionserver logs were saying they were timing out talking to hdfs ports. This led us to a problem with the “datanode” service, and that above blog about restarting services is how we restarted that service.

Just looking through these will help to find what’s broken. var/logs tmp

View autocomplete.py
"""
tkentrycomplete.py
A Tkinter widget that features autocompletion.
Created by Mitja Martini on 2008-11-29.
Updated by Russell Adams, 2011/01/24 to support Python 3 and Combobox.
Updated by Dominic Kexel to use Tkinter and ttk instead of tkinter and tkinter.ttk
Licensed same as original (not specified?), or public domain, whichever is less restrictive.
"""
@nackjicholson
nackjicholson / enhanced_json_encoder.py
Created Jun 9, 2019
json encoder for dataclass instances and enum and times.
View enhanced_json_encoder.py
class EnhancedJSONEncoder(json.JSONEncoder):
def default(self, o):
if is_dataclass(o):
return asdict(o)
if isinstance(o, Enum):
return o.name
if isinstance(o, time):
return o.strftime("%H:%M")
return super().default(o)
@nackjicholson
nackjicholson / events.py
Last active May 13, 2019
snippet of python to verify SNS signatures in flask app.
View events.py
import json
import logging
from base64 import b64decode
from datetime import datetime, timezone
from urllib.request import urlopen
from M2Crypto import X509
from flask import Blueprint, request, jsonify
from werkzeug.exceptions import BadRequest, Unauthorized
@nackjicholson
nackjicholson / emacs.org
Last active Oct 8, 2019
Emacs wisdom from the internet
View emacs.org
View getf1db_howto.md
brew install pgloader
brew install mysql@5.7
brew services start mysql@5.7
brew link mysql@5.7 --force

curl -LO http://ergast.com/downloads/f1db.sql.gz
gunzip -k f1db.sql.gz
View gist:acdd07215690dd093b45f838853a080c
>>> import csv
>>> s = '"Yes, this line",can be, parsed as csv'
>>> list(csv.reader([s]))[0]
['Yes, this line', 'can be', ' parsed as csv']
>>>
@nackjicholson
nackjicholson / s3_utils.py
Last active Oct 3, 2018
s3 list paginator tricks.
View s3_utils.py
import boto3
s3_client = boto3.client('s3')
def list_dirs(bucket, prefix):
""" Yield direct child folders of the given prefix.
"""
@nackjicholson
nackjicholson / retriable.py
Last active Oct 1, 2018
Retriable class decorator, which would allow declaration time AND runtime resetting of decorator properties.
View retriable.py
import time
from functools import wraps, update_wrapper
def scaled_retries(attempts, sleeptime, sleepscale):
scaled_sleeptime = sleeptime
for attempt_no in range(attempts):
yield attempt_no + 1, scaled_sleeptime
scaled_sleeptime *= sleepscale
You can’t perform that action at this time.