Skip to content

Instantly share code, notes, and snippets.

View arronmabrey's full-sized avatar

Arron Mabrey arronmabrey

View GitHub Profile
@arronmabrey
arronmabrey / eta.rb
Last active November 21, 2023 04:34
eta.rb
def eta mod, start_time, total_count, current_time, current_idx
current_count = current_idx + 1
if (current_idx % mod).zero? || current_count >= total_count
percent_done = ((current_count.to_f / total_count.to_f) * 100).round(2)
rem_count = total_count - current_count
run_sec = (current_time - start_time).to_i
avg_parse_time = run_sec.to_f / current_count.to_f
rem_sec = rem_count * avg_parse_time
@arronmabrey
arronmabrey / gitmerged
Last active February 23, 2022 04:48
Checks if feature branches have been merged/squashed/rebased into master
#!/usr/bin/env ruby
ENV["GIT_MERGE_AUTOEDIT"] = "no"
master_branch = "master"
merge_branch = "gitmerged-master"
`git fetch`
fail "uncommited changes" unless `git status --porcelain`.empty?
var go = function(og) {
console.log("go")
var reader = new FileReader();
reader.addEventListener("load", function () {
console.log("reader load", reader.result)
completion(reader.result)
}, false);
fetch(og.src).then(function(req) {
console.log("fetch", req)
req.blob().then(function(data) {
function getBase64Image(img) {
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
var dataURL = canvas.toDataURL("image/png");
return dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
}
@arronmabrey
arronmabrey / rbenv-install-system-wide.sh
Created April 18, 2017 21:26 — forked from endersonmaia/rbenv-install-system-wide.sh
rbenv install and system wide install on Ubuntu 12.04
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@arronmabrey
arronmabrey / ios-type2phone-cli.swift
Created September 16, 2016 16:11
ios-type2phone-cli.swift
#!/usr/bin/env swift
import Foundation
print("Enter keycode to send: ", terminator: "")
if let keycode = readLine() {
print("set keycode = \(keycode)")
@arronmabrey
arronmabrey / spacemacs-git-gutter-with-linum.el
Last active May 10, 2019 07:51
Config git-gutter with linum in Spacemacs
(defun dotspacemacs/layers ()
(setq-default
dotspacemacs-configuration-layers
'((version-control :variables
version-control-global-margin t
version-control-diff-tool 'git-gutter
))))
(defun dotspacemacs/init ()
@arronmabrey
arronmabrey / graph.dot
Last active July 17, 2016 12:58
graphviz hello world
digraph {
hello [color=red]
world [shape=box color=green]
hello -> gist1
a [color=purple]
b [shape=box color=pink]
c [color=blue]
@arronmabrey
arronmabrey / gist:95f1b59c8d0d60d68cb9
Created February 29, 2016 04:16
amazon order/item csv merge
mlr --icsv --ocsv cut -o -f "Order ID","Title","Item Total" then put '$Title=gsub($Title, "\"", "")' items.csv > tmp-items.csv && mlr --icsv --ocsv cut -o -f "Order Date","Order ID","Total Charged","Payment Instrument Type" then nest --implode --values --across-records -f "Total Charged" orders.csv > tmp-orders.csv && mlr --icsv --ocsv join -u -j "Order ID" --lp order_ --rp item_ -f tmp-orders.csv tmp-items.csv > merged.csv && rm tmp-orders.csv tmp-items.csv
@arronmabrey
arronmabrey / shasum-snippet.txt
Last active February 29, 2016 13:51
shasum snippet
find . -type f -print0 | xargs -0 shasum -a 256 | tee shasum256-check.txt
shasum -a 256 -c shasum256-check.txt | tee shasum256-scan.txt