Skip to content

Instantly share code, notes, and snippets.

View TechplexEngineer's full-sized avatar

Blake Bourque TechplexEngineer

View GitHub Profile
@TechplexEngineer
TechplexEngineer / integral.py
Created October 19, 2015 16:03
Some Python & MatPlotLib plotting examples
"""
Plot demonstrating the integral as the area under a curve.
Although this is a simple example, it demonstrates some important tweaks:
* A simple line plot with custom color and line width.
* A shaded region created using a Polygon patch.
* A text label with mathtext rendering.
* figtext calls to label the x- and y-axes.
* Use of axis spines to hide the top and right spines.
@TechplexEngineer
TechplexEngineer / snippet.html
Created October 11, 2015 03:07
Bootstrap View Size Indicator
CURRENT VIEW SIZE:
<span class="visible-xs">xs</span>
<span class="visible-sm">sm</span>
<span class="visible-md">md</span>
<span class="visible-lg">lg</span>
@TechplexEngineer
TechplexEngineer / uuid_historgram.sql
Created October 9, 2015 13:01
Create a histogram of UUIDs by their first character
SELECT LEFT(`assetuuid`,1) as `ST`, count(*) as `CNT`
FROM `tex`
GROUP BY `ST`
-- or two characters
SELECT LEFT(`assetuuid`,2) as `ST`, count(*) as `CNT`
FROM `tex`
GROUP BY `ST`
@TechplexEngineer
TechplexEngineer / uuid_historgram.sql
Created October 9, 2015 13:01
Create a histogram of UUIDs by their first character
SELECT LEFT(`assetuuid`,1) as `ST`, count(*) as `CNT`
FROM `tex`
GROUP BY `ST`
@TechplexEngineer
TechplexEngineer / .bashrc
Last active November 3, 2020 15:51
Dotfiles ... .gitconfig .vimrc
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/local/bin" ] ; then
PATH="$HOME/.local/local/bin:$PATH"
fi
alias git='git number -c git'
export LESS=-ri
@TechplexEngineer
TechplexEngineer / Autopilot.py
Last active August 29, 2015 14:26
HammerDB Autopilot Log parser
#!/usr/bin/env python
import re
###
# This program is good for parsing the direct output from the Autopilot window.
###
# Settings
infile = 'in.log'

I'm retrieving a Base64 encoded image from a webservice and trying to upload it to Cloudinary. I've tried a number of avenues to attempt the upload and all have seemed to fail.

So here was my first attempt. The error is: "TypeError: file() argument 1 must be encoded string without NULL bytes, not str"

#!/usr/bin/env python

import urllib2
import xml.dom.minidom
import base64
@TechplexEngineer
TechplexEngineer / txt_download.js
Last active August 29, 2015 14:26
Javascript to download text as a file. Demo: http://jsfiddle.net/TechplexEngineer/geLvp6bo/
function download (text, filename) {
if (typeof filename === "undefined") {
filename = false;
};
var pom = document.createElement('a');
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
if (filename) {
pom.setAttribute('download', filename);
}
pom.click();
var sec = [
{
name: "Game - The Arena",
subsections: [
{
name: "Field",
subsections: [
"Guardrail",
"Alliance Wall",
"Scoring Platforms",