Skip to content

Instantly share code, notes, and snippets.

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

Brian Pugh BrianPugh

💭
⭐️ PRO
  • Arlington, VA
  • 20:27 (UTC -04:00)
View GitHub Profile
@BrianPugh
BrianPugh / Adding tmux
Last active December 8, 2020 17:45 — forked from sshadmand/Adding tmux
The best and greatest tmux.conf ever
Create a tmux conf file
#> touch ~/.tmux.conf
Install TMP
#> git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
[Copy and paste tmux.conf below into local file.]
Load tmux configurations
#> tmux source-file ~/.tmux.conf
def get_checkpoints(checkpoint_dir):
'''
Finds all checkpoints in a directory and returns them in order
from least iterations to most iterations
'''
meta_list=[]
for file in os.listdir(checkpoint_dir):
if file.endswith('.meta'):
meta_list.append(os.path.join(checkpoint_dir, file[:-5]))
meta_list = sort_nicely(meta_list)
@BrianPugh
BrianPugh / optimistic restore
Last active September 12, 2017 19:29
optimistic restore
def optimistic_restore(session, save_file, variable_scope=''):
'''
A Caffe-style restore that loads in variables
if they exist in both the checkpoint file and the current graph.
Call this after running the global init op.
By DanielGordon10 on December 27, 2016
https://github.com/tensorflow/tensorflow/issues/312
With RalphMao tweak.
bpugh, July 21, 2017: Added a variable_scope so that a network can be
@BrianPugh
BrianPugh / main_template.py
Created July 27, 2017 23:34
template for a python main file to get going as quickly as possible
#!/user/bin/env python
'''
This is a template file to get your project on the road quickly!
Last updated: July 27th, 2017
'''
__author__ = 'Brian Pugh'
__email__ = 'bnp117@gmail.com'
@BrianPugh
BrianPugh / xrb_stress_test_part2_500.svg
Created January 26, 2018 06:58
SVG of the 500 Transaction Initial Test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@BrianPugh
BrianPugh / xrb_stress_test_part2_5000.svg
Created January 26, 2018 07:45
SVG of the 5000 transaction test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Recursively copy all the avi videos in some file structure to a flat folder
# Source: https://stackoverflow.com/a/1936214
find . -iname '*.avi' -exec cp \{\} ../videos/ \;
# ffmpeg convert avi to mp4
ffmpeg -i infile.avi youroutput.mp4
# Convert all avi's in a folder to mp4 with ffmpeg
# Source: https://stackoverflow.com/a/33766147
for i in *.avi; do ffmpeg -i "$i" -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "${i%.*}.mp4"; done
04fcd48e8946c42e7efa9fee5bde9ce58729b8bc389e9f280cd1f50ca8b262e29b8b59ef918f41617cef8d1bc40db64ce9d825aab81bbb39f02fe26a781a794bdd;bradennapier
@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

@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) )