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 python2 | |
# -*- encoding: utf-8 -*- | |
import re | |
import os | |
import sys | |
import json | |
import argparse | |
import yaml | |
from logging import getLogger |
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/sh | |
outfile="/tmp/runst-$$" | |
rustc -o "$outfile" "$1" && "$outfile" | |
rm -f "$outfile" |
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 fish_prompt --description 'Write out the prompt' | |
set -l last_status $status | |
set -l prompt_status | |
if test $last_status -ne 0 | |
if not set -q __fish_prompt_status | |
set -g __fish_prompt_status (set_color $fish_color_status) | |
end | |
set prompt_status "$__fish_prompt_status [$last_status]$__fish_prompt_normal" | |
end |
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
"""A simple addition to Python's optparse module supporting subcommands | |
like those found in the svn or hg CLIs. | |
To use it, instantiate the Subcommand class for every subcommand you | |
want to support. Each subcommand has a name, aliases, a help message, | |
and a separate OptionParser instance. Then pass a list of Subcommands | |
to the constructor of SubcommandsOptionParser to make a subcommand- | |
aware parser. Calling parse_args on that parser gives you the | |
subcommand invoked, the subcommand's arguments and options, and the | |
global options all in one fell swoop. See the smoke test at the bottom |
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
use std::io::net; | |
fn get_my_external_ip() -> Option<net::ip::IpAddr> { | |
net::tcp::TcpStream::connect("8.8.8.8", 53).and_then(|ref mut s| s.socket_name()).map(|a| a.ip).ok() | |
} | |
fn main() { | |
println!("My external IP: {}", get_my_external_ip()); | |
} |
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
#![feature(plugin)] | |
#![plugin(regex_macros)] | |
extern crate regex; | |
use std::ops::Index; | |
use regex::Regex; | |
pub struct Re(Regex); |
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/sh | |
REPO_URL="https://crates.io" | |
API_URL="$REPO_URL/api/v1" | |
die() { | |
echo "$@" >&2 | |
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
#!/bin/sh | |
SELF="$1" | |
MD5=$(md5sum "${SELF}" | cut -f1 -d" ") | |
OUT="${SELF}.${MD5}.out" | |
if [ ! -f "${OUT}" ]; then | |
rustc -C debuginfo=0 -C prefer-dynamic "${SELF}" -o "${OUT}" || exit 1 | |
fi | |
shift | |
exec "${OUT}" "$@" |
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
KEYMAP=us | |
FONT=ter-v18b |
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
I want clean history, but that really means (a) clean and (b) history. | |
People can (and probably should) rebase their _private_ trees (their own | |
work). That's a _cleanup_. But never other peoples code. That's a "destroy | |
history" | |
So the history part is fairly easy. There's only one major rule, and one | |
minor clarification: | |
- You must never EVER destroy other peoples history. You must not rebase |