This file contains 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 node | |
// Loosely based on https://stackoverflow.com/questions/36929209/read-ansi-escape-from-terminal | |
'use strict'; | |
var deasync = require('deasync'); | |
function asyncDSR(opts, callback) { | |
// opts is an optional object: | |
// { in: input } |
This file contains 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
#!/bin/sh | |
# Download a github project's latest release | |
# $1: username/repo | |
# $2: regex to match download file | |
# example: ./gh-download-latest atom/atom gz | |
repo=$1 | |
regex=${2:-gz} | |
wget -qO- https://api.github.com/repos/$repo/releases/latest | \ |
This file contains 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
(require '[clojure.data :refer [diff]]) | |
(def ^:no-doc fs (js/require "fs")) | |
(def ^:no-doc child-process (js/require "child_process")) | |
(def ^:no-doc os (js/require "os")) | |
(def ^:no-doc path (js/require "path")) | |
(def ignore-env-vars #{"_" "OLDPWD" "PWD" "SHELLOPTS" "SHLVL"}) | |
(defn mktemp |
This file contains 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
pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; } | |
.string { color: green; } | |
.number { color: darkorange; } | |
.boolean { color: blue; } | |
.null { color: magenta; } | |
.key { color: red; } |
This file contains 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 bash | |
# Download a file iff URL's HTTP If-Modified-Since header is more recent than | |
# the local file timestamp | |
url="$1" | |
file="$2" | |
shift 2 | |
curl -z "$file" -Lo "$file" "$url" "$@" |
This file contains 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 php | |
<?php | |
require __DIR__.'/miniflux/app/common.php'; | |
use PicoDb\Database; | |
use Miniflux\Model\Item; | |
if (php_sapi_name() !== 'cli') { |
This file contains 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
String.prototype.format = function() { | |
var args = arguments; | |
return this.replace(/{(\d+)}/g, function(match, number) { | |
return typeof args[number] != 'undefined' | |
? args[number] | |
: match | |
; | |
}); | |
}; |
This file contains 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 bash | |
# Cygwin is special | |
if [ -z "${OSTYPE}" ]; then | |
case $(uname) in | |
"CYGWIN*") export OSTYPE='CYGWIN' ;; | |
'Darwin') export OSTYPE='Darwin' ;; | |
'Linux') export OSTYPE='Linux' ;; | |
esac | |
fi |
This file contains 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
#!/bin/bash | |
brew_command=/usr/local/bin/brew | |
brew_cask_command="$brew_command cask" | |
echo '#!/bin/bash' | |
echo '' | |
echo 'trap ctrl_c INT' | |
echo 'function ctrl_c() {' | |
echo 'echo "** Trapped CTRL-C"' |
This file contains 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 plus_equals --no-scope-shadowing | |
set -l __fish_value $$argv[1] | |
set $argv[1] (math $__fish_value + $argv[2]) | |
end |