Skip to content

Instantly share code, notes, and snippets.

View BrianPugh's full-sized avatar
💭
⭐️ PRO

Brian Pugh BrianPugh

💭
⭐️ PRO
  • Arlington, VA
  • 18:02 (UTC -04:00)
View GitHub Profile
@BrianPugh
BrianPugh / readme.md
Last active November 28, 2022 16:50 — forked from Eugeny/readme.md
Frame accurate video reader - OpenCV VideoCapture replacement

OpenCV's VideoCapture is broken and hasn't been fixed for the last 5 years: opencv/opencv#9053

This is a PyAV based replacement. Unlike other implementations it can seek at any time.

Install PyAV:

pip install av
@BrianPugh
BrianPugh / asciichartpy.py
Created August 30, 2022 15:27
Rich-compatible, modern python version of https://github.com/kroitor/asciichart
# -*- coding: utf-8 -*-
"""Module to generate ascii charts.
This module provides a single function ``plot`` that can be used to generate an
ascii chart from a series of numbers. The chart can be configured via several
options to tune the output.
Modified from for modern python and to use ``rich``:
https://github.com/kroitor/asciichart/blob/master/asciichartpy/__init__.py
"""
@BrianPugh
BrianPugh / qi-mod.md
Last active April 22, 2023 17:46
Game and Watch Qi Mod

Parts List

For this mod you just need a Qi Receiver. I recommend getting a USBC Qi Receiver intended for android devices. These can be had off of ebay (at least in the USA) for $3~5 shipped. For some reason I did not have luck with an iphone variant. The USBC version is nice because you can check to see if it works to your satisfaction before physically modding anything.

Qi Card

Do NOT get a generic DIY qi receiver (available on amazon and ebay for about $10) as pictured below. These tend to emit a high pitch squeal when charging.

51VgSnaQbDL AC_SL1001

# Prompt
PROMPT="%m:%~$ "
# Navigation
alias ll='ls -alhG'
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
# Git
alias gs='git status'
@BrianPugh
BrianPugh / discipline.json
Last active December 11, 2020 00:27
Discipline
{"version":1,"notes":"","documentation":"\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n","keyboard":"coseyfannitutti/discipline","keymap":"default_430c370json.json","layout":"LAYOUT_65_ansi_2_right_mods","layers":[["KC_ESC","KC_1","KC_2","KC_3","KC_4","KC_5","KC_6","KC_7","KC_8","KC_9","KC_0","KC_MINS","KC_EQL","KC_BSPC","KC_GRV","KC_TAB","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_LBRC","KC_RBRC","KC_BSLS","KC_DEL","MO(1)","KC_A","KC_S","KC_D","KC_F","KC_G","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_QUOT","KC_ENT","KC_PGUP","KC_LSFT","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_RSFT","KC_UP","KC_PGDN","K
def while_test(lconfig):
""" Simple tensorflow while_loop test within ADNN
Not to be used as an actual loss
"""
def _cond(i_loop, d):
return tf.less(i_loop, 10)
def _body(i_loop, d):
@BrianPugh
BrianPugh / main.c
Created December 2, 2018 23:24
nvs issue
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "nvs_flash.h"
#include "nvs.h"
#include "esp_log.h"
@BrianPugh
BrianPugh / tf_one_liners.py
Last active June 1, 2018 21:53
Useful Tensorflow one-liners
# Name of all Variables in Graph
# Source: https://stackoverflow.com/questions/36883949/in-tensorflow-get-the-names-of-all-the-tensors-in-a-graph
from pprint import pprint
pprint([n.name for n in tf.get_default_graph().as_graph_def().node if "Variable" in n.op ])
# check for substring in list of strings
print( "\n".join(s for s in list if sub in s) )
@BrianPugh
BrianPugh / State-Blocks.md
Last active April 8, 2018 08:12
State-Blocks

NEP-01: State Blocks

NANO

The implementation of state blocks (known as "universal blocks") is a protocol improvement that encodes all account data in every transaction. This allows the following:

  1. Simplifies account balance computation and block verification
  2. Enables inexpensive hardware to easily and securely sign transactions
  3. Aggressive pruning of the block-lattice

Legacy Blocks

04fcd48e8946c42e7efa9fee5bde9ce58729b8bc389e9f280cd1f50ca8b262e29b8b59ef918f41617cef8d1bc40db64ce9d825aab81bbb39f02fe26a781a794bdd;bradennapier