Skip to content

Instantly share code, notes, and snippets.

View Jwink3101's full-sized avatar

Justin Winokur Jwink3101

View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Demo of subplot methods for matplotlib using pyplot only when needed
and doing the main plotting on axes objects
"""
import itertools
import numpy as np
import matplotlib.pylab as plt
@Jwink3101
Jwink3101 / palette.m
Created October 12, 2017 14:45
Plot a palette in Matlab
function palette(cmap,varargin)
%% palette - Plot the color palette for a given map on x,y in [0,1]
% in the current window/axis
% Inputs:
% cmap - N x 3 array of colors --OR-- a cell array of 1x3 colors
% Options/Flags (note the `-` on flags)
% -no-label - If specified, will *never* label. Otherwise, will label
% for N<=10
% -vert - Plot vertically
@Jwink3101
Jwink3101 / python_bash.py
Created January 4, 2018 18:11
Python Bash interaction -- ALPHA (at best)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Interact with bash from python
ALPHA at best and hasn't been tested in a while
"""
from __future__ import print_function, unicode_literals
import subprocess
@Jwink3101
Jwink3101 / open_ssl_from_python
Last active April 9, 2018 19:25
An example I am working on to use openssl via subprocess from Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple example of calling openSSL from python. Also with base64 set since I
will want to store in a text file
"""
from __future__ import print_function, unicode_literals
import subprocess
import shlex
@Jwink3101
Jwink3101 / parmap.py
Last active August 8, 2018 13:25
parmap.py -- multiprocessing tool to help simplify parallel function evaluation
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals, absolute_import
__version__ = '20180726.0'
__status__ = 'beta'
import multiprocessing as mp
import multiprocessing.dummy as mpd
from threading import Thread
@Jwink3101
Jwink3101 / Qhull_demo.ipynb
Created August 22, 2018 21:37
Qhull as boundary
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Jwink3101
Jwink3101 / barebone_dup_finder.py
Created August 12, 2019 15:54
Super, super, super barebones, barely-tested, feature-less duplicate file finder
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Find duplicate files
Warning: This has not been thouroughly tested and is missing many
features including exlucsions, error handling, parallelism, etc.
This is barebones
Process:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Apply the same git commands to all git repositories below to a specified depth
(default 1). Note: Will go below a top level repo for submodules, etc. WARNING:
if there is ambiguity as to git flags vs git-all (this code) flags, separate
with `--`
"""
from __future__ import division, print_function, unicode_literals, absolute_import
@Jwink3101
Jwink3101 / Matplotlib_Cheatsheet
Last active October 27, 2020 23:43
My personal, ever-evolving, matplotlib cheatsheet. Updated: 2018-09-21
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Matplotlib Tips and Demos\n",
"\n",
"When I first learned Python three years ago, I was often finding myself having to lookup the same thing again and again for Matplotlib. This was back pre-2.0 when there was even more issues (e.g. plotting `NaNs` with masked arrays). \n",
"\n",
@Jwink3101
Jwink3101 / finddupes.py
Last active November 20, 2020 02:19
Really barebones duplicate file finder. Doesn't even have a CLI
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Duplicate file finder. Finds dupe files by comparing the following attributes.
Matching size is nessesary but very, very far from sufficient. Still, it is very
fast so we use that to cut out a lot of files.
* size
* Obviously not at all robust but a nessesary
* CRC checksum