Skip to content

Instantly share code, notes, and snippets.

View tmlbl's full-sized avatar

Tim tmlbl

View GitHub Profile
@tmlbl
tmlbl / roach.go
Created March 19, 2015 20:34
Trying to use cockroachdb
package main
import (
"fmt"
"net/http"
"time"
"github.com/cockroachdb/cockroach/client"
"github.com/cockroachdb/cockroach/proto"
)
@tmlbl
tmlbl / typed.ts
Created April 21, 2015 23:00
Typed Class
class Typed<T> {
type: T
constructor(obj: T) {
this.type = obj;
}
}
interface MyType {
prop: string;
@tmlbl
tmlbl / Colors.jl
Created June 1, 2015 17:11
Symbol dict example
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",
@tmlbl
tmlbl / macro.jl
Last active August 29, 2015 14:22
Macro problems
macro stringall(msg...)
return :(join(map((i) -> string(eval(i)), $msg), " "))
end
x = "foo"
function test()
x = "bar"
global y = "baz"
@stringall x y
@tmlbl
tmlbl / jvm
Last active March 20, 2016 06:19
JVM - Julia Version Manager
#!/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=""
@tmlbl
tmlbl / meetup.jl
Last active October 27, 2015 01:07
Script to find Julia developers in your area using the GitHub API
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}
@tmlbl
tmlbl / bank.sh
Created June 1, 2016 07:51
A quick bash script to encrypt a directory with a passkey.
#!/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;
@tmlbl
tmlbl / longline.go
Created February 22, 2017 03:54
A Go utility to check that lines are less than 80 characters in source code
package main
import (
"bufio"
"errors"
"flag"
"fmt"
"os"
"path/filepath"
"strings"
@tmlbl
tmlbl / touch.ps1
Created June 26, 2017 18:32
Unix 'touch' command for PowerShell
function touch() {
<#
.SYNOPSIS
An analog to the UNIX 'touch' command
.DESCRIPTION
This approximates common usage of the UNIX 'touch' command. If the target
file does not exist, it is created as a regular file. If it does exist, the
last access time is set to the current time.
.PARAMETER fname
The target file path
@tmlbl
tmlbl / x-blink.js
Last active September 20, 2017 21:19