Skip to content

Instantly share code, notes, and snippets.

# pdflatex options:
# -shell-escape is used by the minted package to call pygments
# -interaction=nonstopmode stops pdflatex waiting for user input on errors
pdflatex = pdflatex -shell-escape -interaction=nonstopmode report.tex
pdflatex_warn = $(pdflatex) | grep Warning | grep -v 'float' | sed "s/^LaTeX / /"
pdflatex_error = $(pdflatex) | grep -e "^!" | sed "s/^! / Error: /"
pdflatex_quiet = $(pdflatex) >/dev/null
# Other tools
texcount = texcount -merge -template="{1}" report.tex
//! Wrapper around Rc<Box<T>>
#![allow(dead_code)]
use std::ops::{Deref,DerefMut};
use std::rc::Rc;
struct Reference<T: ?Sized>(Rc<Box<T>>);
impl<T : ?Sized> Reference<T> {
@borntyping
borntyping / Cargo.lock
Created March 17, 2015 17:18
rust-protobuf failing to encode messages with numbers set
[root]
name = "rust-protobuf-repro"
version = "0.0.1"
dependencies = [
"protobuf 0.0.9 (git+https://github.com/stepancheg/rust-protobuf.git)",
]
[[package]]
name = "protobuf"
version = "0.0.9"
RUN apt-get install -y nodejs npm
---> Running in f389969cc6f7
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
binutils build-essential cpp cpp-4.8 dpkg-dev fakeroot g++ g++-4.8 gcc
gcc-4.8 gyp javascript-common libalgorithm-diff-perl
libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan0 libatomic1
libc-ares-dev libc-ares2 libc-dev-bin libc6 libc6-dev libcloog-isl4
use std::collections::HashMap;
use std::fmt::Debug;
use std::rc::Rc;
// Resources -------------------------------------------------------------------
trait Resource : Debug { }
trait Process : Resource + Debug { }
trait Service : Resource + Debug { }
@borntyping
borntyping / tg
Last active August 29, 2015 14:16
$ tg
Usage: tg [options] <tag> <command> [...]
Show information about tagged repositories
Availible tags: @cyborg, @python, @rust
Subcommands:
add Add a repository to the tag
journal Show commits in order for a given period
pdflatex = pdflatex
-interaction=batchmode
pdflatex_err = pdflatex -interaction=nostopmode
texcount = " Words in text: {1}\n Words in headers:{2}\n"
report.pdf: *.tex extras/report.bib
@echo "\033[32m`date +%T` Building $@\033[0m"
@echo "\033[34m`date +%T` Running pdflatex\033[0m"
@$(pdflatex) report.tex | grep Warning | sed "s/^LaTeX / /"
@echo "\033[34m`date +%T` Running bibtex\033[0m"
sam@centurion ~borntyping/cyborg git:master $ cargo run -- ~borntyping/rust-wrecking-ball/target/memory.pid
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling cyborg v0.0.1 (file:///home/sam/Development/borntyping/cyborg)
Running `target/cyborg /home/sam/Development/borntyping/rust-wrecking-ball/target/memory.pid`
--- Process { pid: 28381, name: "<main>", status: Sleeping }
--- Memory { rss: 37987, vms: 11650, shared: 320, text: 215, lib: 0, data: 33882, dirty: 0 }
-!- PID 28381 has exceded memory limit by 7987 bytes (37987 / 30000)
-!- Sending SIGKILL to PID 28381
-!- PID no longer exists (couldn't open path as file)
--- Detail: no such file or directory (No such file or directory); path=/proc/28381/stat; mode=open; access=read
@borntyping
borntyping / Cargo.toml
Created February 5, 2015 09:22
rust-stability-example
[package]
name = "rust-stability-example"
version = "0.0.1"
authors = ["Sam Clements <sam@borntyping.co.uk>"]
@borntyping
borntyping / acs-mmp.md
Last active August 29, 2015 14:13
ACS Major projects (2015)