This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,/, ""); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env swift | |
import Foundation | |
print("Enter keycode to send: ", terminator: "") | |
if let keycode = readLine() { | |
print("set keycode = \(keycode)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph { | |
hello [color=red] | |
world [shape=box color=green] | |
hello -> gist1 | |
a [color=purple] | |
b [shape=box color=pink] | |
c [color=blue] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -print0 | xargs -0 shasum -a 256 | tee shasum256-check.txt | |
shasum -a 256 -c shasum256-check.txt | tee shasum256-scan.txt |
NewerOlder