There are several primary steps:
- build toolchain with crosstool-ng
- compile libunwind and add to toolchain
- compile std with the new toolchain
- link rust-cross toolchain with rustup
- build rust binaries :)
| defmodule GenServerTpl do | |
| @moduledoc """ | |
| A GenServer template for a "singleton" process. | |
| """ | |
| use GenServer | |
| # Initialization | |
| def start_link(opts \\ []) do | |
| GenServer.start_link(__MODULE__, opts, [name: __MODULE__]) | |
| end |
| [Unit] | |
| Description=AutoSSH reverse tunnel service for jump.you.io 100022 -> 22 | |
| After=network.target | |
| [Service] | |
| Environment="AUTOSSH_GATETIME=0" | |
| ExecStart=/usr/bin/autossh -M 0 -o "ExitOnForwardFailure=yes" -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -NR 10022:127.0.0.1:22 [email protected] -i /home/root/.ssh/id_rsa | |
| [Install] | |
| WantedBy=multi-user.target |
| # GNU Screen - main configuration file | |
| # All other .screenrc files will source this file to inherit settings. | |
| # Author: Christian Wills - [email protected] | |
| # Allow bold colors - necessary for some reason | |
| attrcolor b ".I" | |
| # Tell screen how to set colors. AB = background, AF=foreground | |
| termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' |
Disclaimer: there may be errors in these examples. Copy them at your own risk.
Some snippets and examples I want to be able to refer to while learning the Rust Language. Having the snippets here makes it easier for me to remember them.
I have found it useful to be able to convert a Vec<T> into a Vec<String>, especially for tests where I want to convert a Vec<str> into a Vec<String> for use elsewhere in the application.
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # All Vagrant configuration is done below. The "2" in Vagrant.configure | |
| # configures the configuration version (we support older styles for | |
| # backwards compatibility). Please don't change it unless you know what | |
| # you're doing. | |
| Vagrant.configure(2) do |config| | |
| # Every Vagrant development environment requires a box. You can search for |
| require 'Unirest' | |
| require 'json' | |
| puts "testing" | |
| begin | |
| url = "http://stage.maasive.net/v2.4/5379f153b2c4271b06d88351/plays/" | |
| parameters = { | |
| :user_score=>5, | |
| :alien_score=>1, |
| import requests | |
| import time | |
| import random | |
| from hashlib import sha1 | |
| import hmac | |
| import binascii | |
| from getpass import getpass | |
| from urllib import urlencode, quote, quote_plus | |
| from urlparse import parse_qs | |
| from pprint import pprint, pformat |
| class MessagesHandler(tornado.web.RequestHandler): | |
| @tornado.gen.coroutine | |
| def get(self): | |
| db = self.settings['db'] | |
| rb = [] | |
| cursor = db.messages.find().sort([('_id', -1)]) | |
| messages = yield cursor.to_list(length=50) | |
| while messages: | |
| [rb.append({'id': m['_id'], 'msg': m['msg']}) for m in messages] | |
| messages = yield cursor.to_list(length=50) |