Skip to content

Instantly share code, notes, and snippets.

View teamcity-agent.sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: TeamCity_BuildAgent
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start build agent daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
View atom-rust-packages
# Run this in your shell to install a set of atom-plugins
# for working with rust projects and git
# Rust essentials
apm install language-rust racer linter linter-rust build build-cargo cargo-test-runner rust-api-docs-helper
# Other
apm install keyboard-localization autoupdate-packages project-manager atom-terminal minimap docblockr theme-switcher
# Git
@colin-kiegel
colin-kiegel / gist:b35d278d6ed5251dfa85
Created Dec 1, 2015
regex replace multi-line + in multiple files
View gist:b35d278d6ed5251dfa85
$FILES="*.rs"
$REGEX="s#(.*)\n(.*)/\2\n\1/"
find . -name "$FILES" | xargs perl -0777 -pi -e '$REGEX'
# flag: -0777 tells perl to read the file as a whole
# replace '-pi' with '-pi.bak' to create backups
@colin-kiegel
colin-kiegel / pre-compile-hhvm.sh
Created Mar 30, 2015
HHVM PreCompile-Script for RepoAuthoritative Mode
View pre-compile-hhvm.sh
#!/bin/bash
# CONFIGURATION: #############
echo "You need to edit this script before running it the first time."
exit # remove this line after finishing your configuration
WWW_DIR="/www/pub/ilias-trunk"
FILE_MASK="\\*.php"
INDEX_TMP="/var/run/hhvm/precompiled/fileindex"
View racer-update
#!/bin/bash
RACER_SRC_PATH="/usr/local/src/racer"
RACER_REPO="https://github.com/phildawes/racer.git"
RUST_REPO="https://github.com/rust-lang/rust.git"
if [ -z $RUST_SRC_PATH ]; then
echo "TODO: Set the RUST_SRC_PATH env variable to point to the 'src' dir in your rust source installation, e.g.:
export RUST_SRC_PATH=/usr/local/src/rust/src";
RUST_SRC_PATH=/usr/local/src/rust/src
@colin-kiegel
colin-kiegel / generic_assertions.rs
Last active Mar 22, 2017
thoughts about assert_cli ... :-)
View generic_assertions.rs
/// Warning: Pseudo-Rust Code
/// Some rough ideas how `assert_cli` could accept arbitrary assertions and possibly
/// support interactive commands.
///
/// The current simple API could be implemented on top of this more general one.
Cmd::run("")
.with_timeout(Duration(...))
.assert(StdOut::ends_with("Are you sure?")) // ::starts_with, ::eq, ::ne, ::contains
View no_std_expanded.rs
#![feature(prelude_import)]
#![no_std]
#![no_std]
#![feature(collections)]
#![allow(dead_code)]
#[prelude_import]
use core::prelude::v1::*;
#[macro_use]
extern crate core as core;
@colin-kiegel
colin-kiegel / rust_macros_1.1.html
Created Feb 1, 2017
Rust Cologne Meetup 2017-02-01 - macros 1.1
View rust_macros_1.1.html
<!DOCTYPE html>
<html>
<head>
<title>macros 1.1</title>
<meta charset="utf-8">
<style>
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
@colin-kiegel
colin-kiegel / main.rs
Last active Aug 13, 2016
#2: Should builder methods use `mut self` or `&mut self`?
View main.rs
mod builder {
#[derive(Default, Clone)]
pub struct Channel {
a: i32,
b: i32,
c: i32,
}
impl Channel {
pub fn a<VALUE: Into<i32>>(&mut self, value: VALUE) -> &mut Self {
@colin-kiegel
colin-kiegel / bar.rs
Created Aug 13, 2016
#3: Should builder methods use `mut self` or `&mut self`?
View bar.rs
#![crate_type = "lib"]
#![crate_name = "bar"]
extern crate foo;
use foo::Channel;
pub fn a<VALUE: Into<i32>>(mut builder: Channel, value: VALUE) -> Channel {
builder.a(value.into()).clone()
}
pub fn b<VALUE: Into<i32>>(mut builder: Channel, value: VALUE) -> Channel {