Skip to content

Instantly share code, notes, and snippets.

View resume.json
{
"meta": {"theme": "elegant"},
"basics": {
"name": "Paul Colomiets",
"label": "CTO / Tech Lead",
"picture": "https://2017.rustfest.eu/assets/speakers/paul.jpg",
"email": "paul@colomiets.name",
"phone": "+380664007850",
"website": "https://github.com/tailhook",
"summary": "I'm a full stack developer who can also manage people to make projects bigger than myself. Love big challenges. Push high performance. Obsessive on the microservices (not really).",
View blake2.rs
#![feature(test)]
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
View service.rs
trait Service<T, R>: Sink<SinkItem=(T, Sender<R>)> {
fn call(&mut self, req: T) -> impl Future {
let (tx, rx) = oneshot();
match self.start_send((req, tx)) {
Ok(Async::NotReady(e)) => { return Err(busy()).into_future() }
Ok(Async::Ready) => { return rx; }
Err(e) => { return Err(e).into_future() }
}
}
}
View redis_with_ns.rs
extern crate env_logger;
extern crate futures;
extern crate abstract_ns;
extern crate tokio_core;
extern crate tokio_redis as redis;
extern crate ns_dns_tokio;
use std::error::Error;
use abstract_ns::Resolver;
View example_deploy.sh
#!/bin/sh -ex
VAGGA=${VAGGA:-vagga}
SERVER=server.example.org
PROJECT=myapp
CONTAINER=example-container
type $VAGGA
type rsync
View daemon.sh
#!/bin/sh
WORKDIR=/tmp/repo-sync-workdir
# Read all the branches in the last 24 hours when starting to make sure we
# don't get out of sync
branches="$(hg log --template '{branch}\n' -d 'yesterday to now')"
trap "true" USR1 # This is a signal to wakeup from sleeping
@tailhook
tailhook / vagga.yaml
Created Jul 15, 2016
Elasticsearch 1.7.0
View vagga.yaml
containers:
elastic:
setup:
- !Ubuntu xenial
- !UbuntuUniverse
# elastic PGP & Repo
- !AptTrust
server: pgp.mit.edu
keys: [D88E42B4]
View example.diff
--- examples/context.rs 2016-06-17 00:55:28.578244188 +0300
+++ examples/backtrace.rs 2016-06-17 00:59:10.613723109 +0300
@@ -1,4 +1,5 @@
#[macro_use(quick_error)] extern crate quick_error;
+extern crate backtrace;
use std::io::{self, stderr, Read, Write};
use std::fs::File;
@@ -7,6 +8,7 @@
use std::path::{Path, PathBuf};
View file_with_context.rs
fn render_docs(source: &Path, dest: &Path) -> Result<(), io::Error> {
let dir_list = try!(read_dir(source).context(source));
for entry_res in dir_list {
let entry = try!(entry_res.context(source));
let path = entry.path();
let file = try!(File::open(&path).context(&path));
for line_res in file.lines() {
let line = try!(line_res.context(&path));
// ...
View qerr_with_context.rs
quick_error! {
enum DocsError {
Io(path: PathBuf, io::Error) {
context(path: &Path, err: io::Error)
-> (path.to_path_buf(), err)
}
Format(path: PathBuf, lineno: usize, doc::FormatError) {
context(file_line: (&Path, usize), err: io::Error)
-> (file_line.0.to_path_buf(), file_line.1, err)
}