Skip to content

Instantly share code, notes, and snippets.

View mehcode's full-sized avatar

Ryan Leckey mehcode

View GitHub Profile
@mehcode
mehcode / main.rs
Created June 26, 2018 05:17
Benchmark sha1 implementations
extern crate sha1;
// extern crate sha1 as sha_1;
extern crate ring;
use std::io::{Read, Write};
use std::time::{Instant, Duration};
use std::process::{Command, Stdio};
fn time<F, FMT>(desc: &str, f: F, fmt: FMT) where F: Fn(), FMT: Fn(Duration) -> String {
let start = Instant::now();
Compiling ring v0.12.1 (file:///Users/mehcode/Workspace/github.com/briansmith/ring)
error: failed to run custom build command for `ring v0.12.1 (file:///Users/mehcode/Workspace/github.com/briansmith/ring)`
process didn't exit successfully: `/Users/mehcode/Workspace/github.com/briansmith/ring/target/debug/build/ring-a72db50caf983fb4/build-script-build` (exit code: 101)
--- stdout
TERM_SESSION_ID: w0t4p0:FD0C0DE1-2255-42A5-A4BB-3CDD5BB3F389
SSH_AUTH_SOCK: /private/tmp/com.apple.launchd.ZAIVR2XkYu/Listeners
Apple_PubSub_Socket_Render: /private/tmp/com.apple.launchd.mmlpreS06w/Render
COLORFGBG: 15;0
ITERM_PROFILE: Default
XPC_FLAGS: 0x0
@mehcode
mehcode / Logging.md
Created January 30, 2017 06:36
Web Framework Research

Startup

A startup message should contain the following information:

  • [debug] Configuration Environment (Development/Staging/Production)
  • [debug] Version of Rust (the Language), Rocket (the Framework), and the Project
  • [debug] Mounts
  • [info] Timestamp
  • [info] Address and Port

Examples

config-rs

  • Support reading from TOML, JSON, YAML, and "whatever format the dotenv one is called"
  • Support reading from etcd
  • Support reading from environment variables
  • Support both a "frozen" and "liquid" configuration

wsdl-rs

  • Parse WSDL files and iterate through Services and Actions

soap-rs

sudo apt-get install libsdl-dev libfreetype6-dev
pip install hg+http://bitbucket.org/pygame/pygame
@mehcode
mehcode / install-pygtk.sh
Created August 7, 2013 09:49
Install pygtk inside of a virtualenv
# Ensure we're in a virtualenv.
if [ "$VIRTUAL_ENV" == "" ]
then
echo "ERROR: not in a virtual environment."
exit -1
fi
# Setup variables.
CACHE="/tmp/install-pygtk-$$"
@mehcode
mehcode / main.py
Created June 3, 2012 05:37
FizzBuzz
if __name__ == '__main__':
for i in range(1, 101):
print("FizzBuzz"[i * i % 3 * 4 : 8 - -i ** 4 % 5] or i)