Checkout a remote branch to a new local branch
git pull
git checkout -b local-branch origin/remote-branch
Remove a remote branch (e.g. from Github once merged)
| -module(minecraft). | |
| -export([start/1, login/2, listen/0]). | |
| -define(KEEPALIVE, 16#00). | |
| -define(LOGIN, 16#01). | |
| -define(HANDSHAKE, 16#02). | |
| -define(TIME_UPDATE, 16#04). | |
| -define(KICK, 16#FF). | |
| -define(HANDSHAKE_MESSAGE(Username), list_to_binary([<<?HANDSHAKE:8>>, string_to_unicode_binary(Username)])). |
| -module(hacking). | |
| -export([connect/0]). | |
| connect() -> | |
| {ok,Socket} = gen_tcp:connect("127.0.0.1", 25565, [binary, {packet, 0}]), | |
| receive_data(Socket). | |
| receive_data(Socket) -> | |
| receive | |
| {tcp,Socket,Bin} -> |
| # First reformat in to CSV and remove duff fields | |
| cat npgj2ee1.nature.com_nature_access.log.2011-03-11 | awk -F"( \"| -)" '{ if ($1 ~ /^Timestamp /) {next;}; printf "%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s\n", $1, $2, $4, $5, $6, $7, $9, $10, $11, $12, $13, $14 }' | sed -e 's/"//g' > sample.log | |
| # Now process sensitive fields | |
| require 'csv' | |
| require 'digest/md5' | |
| output_string = CSV.generate do |output| | |
| CSV.foreach(ARGV.first) do |row| |
| (def *all-roman* ["M" "CM" "D" "CD" "C" "XC" "L" "XL" "X" "IX" "V" "IV" "I"]) | |
| (def *all-decimal* [1000 900 500 400 100 90 50 40 10 9 5 4 1]) | |
| (defn output-as-roman | |
| ([n] (output-as-roman n *all-roman* *all-decimal*)) | |
| ([n rx nx] | |
| (let [roman (first rx) divisor (first nx) | |
| remainder (mod n divisor) quotient (quot n divisor)] | |
| (str (apply str (repeat quotient roman)) | |
| (if (> remainder 0) (output-as-roman remainder (rest rx) (rest nx))))))) |
| (defn rpad-seq | |
| [s n x] | |
| (if (< (count s) n) | |
| (seq (apply conj (vec s) (replicate (- n (count s)) x))) | |
| s)) | |
| => (rpad-seq (list "a" "b" "c") 10 "d") | |
| ("a" "b" "c" "d" "d" "d" "d" "d" "d" "d") |