Skip to content

Instantly share code, notes, and snippets.

View davehorner's full-sized avatar

David Horner davehorner

View GitHub Profile
@davehorner
davehorner / simple.py
Created November 9, 2021 00:31 — forked from cswiercz/simple.py
A quick demonstration of how to plot multivalued complex functions in Python.
import numpy
import sympy
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
from matplotlib import cm, colors
from matplotlib import pyplot as plt
branching_number = 2
@davehorner
davehorner / Convert Script – README.md
Created November 5, 2021 02:48 — forked from Zehkul/Convert Script – README.md
Script to quickly convert and crop videos from within mpv

#README:

This script for mpv intends to offer the fastest and simplest way to convert parts of a video—while you’re watching it and not really more work intensive than making a screenshot. A short demonstration: https://d.maxfile.ro/omdwzyhkoa.webm

##Installation:

You need:

  • yad (at least 0.26) (AUR)
@davehorner
davehorner / cached_factory.cpp
Created November 5, 2021 01:06 — forked from cswiercz/cached_factory.cpp
Herb Sutter's favorite sub-10 line C++ snippet: Factory w/Cache
/*
Cached Factory
Sometimes you want to make objects with a lifetime managed
by their target owner but you also want to hold reference
to them in a custom cache. The target owner, naturally, will
be given a shared_ptr to the output object. However, we don't
want the lifetime of the output object to be tied to the
internal cache. I.e. if the owner dies then the object should
die even if referenced in the cache.
We couldn’t find that file to show.
@davehorner
davehorner / video_save.py
Created September 29, 2020 19:36 — forked from imamdigmi/video_save.py
TensorFlow object detection with video and save the output using OpenCV
"""
This notebook will demontrate a pre-trained model to recognition plate number in an image.
Make sure to follow the [installation instructions](https://github.com/imamdigmi/plate-number-recognition#setup) before you start.
"""
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
@davehorner
davehorner / gist:893c7e760b8b471e9cecec36a46614ac
Created July 28, 2020 18:45
aws query ec2 ips by name filter
aws --no-verify-ssl ec2 describe-instances --filters="Name=tag:Name,Values=*example*" --output json --query "Reservations[*].Instances[*].[PrivateIpAddress,InstanceId,Tags[?Key==`Name`].Value]"
one tab to another tab, press SHIFT+j or SHIFT+k
back and forward, press SHIFT+h and SHIFT+l
x close tab, SHIFT+x to restore.
SHIFT+T search all tabs.
gi focus the first text input filed.
"?" gives me.
Vimium Help
Options Wiki ×
Navigating the page
@davehorner
davehorner / buildfish.sh
Last active April 15, 2020 05:30
build fish shell on raspberry pi raspbian/
apt-get install build-essential cmake devscripts libpcre2-dev libncurses5-dev
git clone https://github.com/fish-shell/fish-shell.git
cd fish-shell;
mkdir build; cd build
cmake ..
make
sudo make install
@davehorner
davehorner / setpaste
Last active July 1, 2021 18:16
vim commenting out pasted text?
press the middle mouse button.
Enter paste mode before you paste:
:set paste
To switch back to "normal" mode:
:set nopaste
@davehorner
davehorner / aws-kms-encrypt
Created April 10, 2020 17:15
# aws-kms-encrypt , cloudformation decrypt export as env param.
# aws-kms-encrypt , cloudformation decrypt export as env param.
aws ssm put-parameter \
--type String \
--name '/YOUR/PARAM/NAME' \
--value $(aws kms encrypt \
--output text \
--query CiphertextBlob \
--key-id <YOUR_KEY_ID> \
--plaintext "PLAIN TEXT HERE")