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
#!/bin/bash | |
BANK_DIR=$HOME/.bank | |
mkdir -p $BANK_DIR; | |
if [ "$1" = "lock" ]; then | |
if [ -e $BANK_DIR.tar.gz.gpg ]; then | |
echo "$BANK_DIR already locked."; | |
exit 1; |
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
using HTTPClient: HTTPC | |
using JSON | |
# Fill in your city name and GitHub API token | |
const MEETUP_LOCATION = lowercase("Seattle") | |
const API_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
# Pages of search results to examine. Warning - you WILL hit the rate limit | |
const NUM_PAGES = 1 | |
typealias Field Union{AbstractString,Void} |
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
#!/bin/bash | |
# I keep Julia binaries in /opt/julia with the same directory structure | |
# as ~/.julia to store different versions, and use this script to switch | |
# between them. I also like to maintain a link of the ~/.julia folder to | |
# ~/julia, for easier package development. | |
JBIN="" | |
PDIR="" |
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
macro stringall(msg...) | |
return :(join(map((i) -> string(eval(i)), $msg), " ")) | |
end | |
x = "foo" | |
function test() | |
x = "bar" | |
global y = "baz" | |
@stringall x y |
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
const text_colors = AnyDict( | |
:black => "\033[1m\033[30m", | |
:red => "\033[1m\033[31m", | |
:green => "\033[1m\033[32m", | |
:yellow => "\033[1m\033[33m", | |
:blue => "\033[1m\033[34m", | |
:magenta => "\033[1m\033[35m", | |
:cyan => "\033[1m\033[36m", | |
:white => "\033[1m\033[37m", | |
:normal => "\033[0m", |
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
class Typed<T> { | |
type: T | |
constructor(obj: T) { | |
this.type = obj; | |
} | |
} | |
interface MyType { | |
prop: string; |
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"time" | |
"github.com/cockroachdb/cockroach/client" | |
"github.com/cockroachdb/cockroach/proto" | |
) |
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
#!/bin/bash | |
# Asks the user a yes or no question, returning the boolean result | |
# $1: Message message to print | |
# $2: Default answer (defaults to "no" (1)) | |
std_askyesno() { | |
local CONF="y/N" | |
if [[ $2 == 0 ]]; then local CONF="Y/n"; fi | |
local reply="n" | |
read -p "$1 $CONF " -n 1 -r reply |
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
#!/bin/bash | |
test_exec() { | |
echo -e "Checking for command: \e[34m$1\e[0m" | |
EX=$(which $1) | |
if [[ ! "$EX" ]]; then | |
echo -e "\e[31mUh oh! It looks like you need to install $1:" | |
echo -e "$2\e[0m" | |
exit 1 | |
else |
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
using HttpCommon | |
using Dates | |
# Creating a query string that will encode unix datetimes | |
# given Julia DateTimes. Methods to handle more types could | |
# easily be added. | |
function qstring(kv::Tuple...) | |
encodeval(v::String) = encodeURI(v) | |
encodeval(dt::DateTime) = string(int64(datetime2unix(dt))) | |
encodepair(p::Tuple) = string(encodeval(p[1]), "=", encodeval(p[2]), "&") |