Skip to content

Instantly share code, notes, and snippets.

View itsmontoya's full-sized avatar

Josh Montoya itsmontoya

View GitHub Profile
func Reverse <type Element> (s []Element) {
first := 0
last := len(s) - 1
for first < last {
s[first], s[last] = s[last], s[first]
first++
last--
}
}
var iotaSeedGenerator = (function(){
const arr = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',9]
function getRandomChars(){
var str = "";
for(var i=0; i<81;i++){
str += arr[rand(0,26)];
}
return str;
panda@pandaHQ~: $ wrk http://localhost:3000
Running 10s test @ http://localhost:3000
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.00us 0.00us 0.00us -nan%
Req/Sec 16.20 20.49 40.00 60.00%
30 requests in 10.01s, 3.43KB read
Socket errors: connect 0, read 0, write 0, timeout 30
Requests/sec: 3.00
Transfer/sec: 350.55B
// https://github.com/itsmontoya/hello_world_rs/blob/master/src/main.rs#L43
#[async]
fn fooResp() -> Result<Response, i32> {
let mut rx_set = Vec::new();
rx_set.push(greeting());
rx_set.push(greeting());
rx_set.push(greeting());
#![feature(proc_macro, conservative_impl_trait, generators)]
extern crate futures_await as futures;
use futures::prelude::*;
#[async]
fn foo() -> Result<i32, i32> {
Ok(1 + await!(bar())?)
}
[package]
name = "hello_world"
version = "0.1.0"
authors = ["itsMontoya <josh@montoya.io>"]
[dependencies]
hyper = "0.11.2"
futures_await = { git = "https://github.com/alexcrichton/futures-await" }
//
const io = @import("std").io;
pub fn main(args: [][]u8) -> %void {
var g = Greeter{
.greeting = "hello world",
};
g.Greet();
}
pub fn main(args: [][]u8) -> %void {
var g = Greeter{
greeting: "hello world",
}
}
const Greeter = struct{
greeting: string,
}
const io = @import("std").io;
pub fn main(args: [][]u8) -> %void {
var g = Greeter{
greeting: "hello world",
}
%%io.stdout.printf(g.greeting + "\n");
}
/tmp/yaourt-tmp-panda/aur-zig/src/zig/src/codegen.cpp:4850:68: error: ‘LLVMGetTargetMachineData’ was not declared in this scope
g->target_data_ref = LLVMGetTargetMachineData(g->target_machine);
^
[9/25] Building CXX object CMakeFiles/zig.dir/src/parser.cpp.o==> ERROR: A failure occurred in build().