Skip to content

Instantly share code, notes, and snippets.

🦀
finding my happy place...

Sonny Scroggin scrogson

🦀
finding my happy place...
View GitHub Profile
@scrogson
scrogson / playground.rs
Created May 16, 2020 — forked from anonymous/playground.rs
Shared via Rust Playground
View playground.rs
#[macro_use]
extern crate hyper;
extern crate reqwest;
use reqwest;
use std::io::Read;
header! { (ContentType, "Content-Type") => [String] }
header! { (ContentLength, "Content-Length") => [usize] }
View Dockerfile
FROM node:12.2-slim as assets
WORKDIR /app/assets
COPY assets/package*.json ./
RUN npm install
# Copy the entire app so we can put files into /app/priv/static
COPY . /app
View task.rs
use std::future::Future;
use tokio::runtime::{Builder, Runtime};
use tokio::task::JoinHandle;
lazy_static::lazy_static! {
static ref TOKIO: Runtime = Builder::new()
.threaded_scheduler()
.build()
.expect("Franz.Native: Failed to start tokio runtime");
}
@scrogson
scrogson / after.valgrind.log
Last active Dec 11, 2019
Rustler Segfault - OwnedEnv::send_and_clear
View after.valgrind.log
==14241== Memcheck, a memory error detector
==14241== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==14241== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==14241== Command: /home/scrogson/otp/bin/x86_64-unknown-linux-gnu/beam.valgrind.smp -S 8:8 -SDcpu 8:8 -- -root /home/scrogson/otp -progname /home/scrogson/otp/bin/cerl\ -valgrind -- -home /home/scrogson -- -kernel shell_history enabled -- --track-origins=yes -kernel shell_history enabled -pa /usr/local/lib/elixir/bin/../lib/eex/ebin /usr/local/lib/elixir/bin/../lib/elixir/ebin /usr/local/lib/elixir/bin/../lib/ex_unit/ebin /usr/local/lib/elixir/bin/../lib/iex/ebin /usr/local/lib/elixir/bin/../lib/logger/ebin /usr/local/lib/elixir/bin/../lib/mix/ebin -elixir ansi_enabled true -noshell -s elixir start_cli -- -- -extra /usr/local/bin/mix test
==14241==
==14241== Warning: set address range perms: large range [0x643d000, 0x4643d000) (noaccess)
warning: variable "i" is unused (if the variable is not meant to be us
View kafka.bnf
# generated code, do not edit!
#ApiKey: Produce, 0
ProduceRequestV0 => acks timeout [topic_data]
acks => INT16
timeout => INT32
topic_data => topic [data]
topic => STRING
data => partition record_set
partition => INT32
View keybase.md

Keybase proof

I hereby claim:

  • I am scrogson on github.
  • I am scrogson (https://keybase.io/scrogson) on keybase.
  • I have a public key ASDCQthqJvMSr2oa_EFbEiJAcnQmuQZuW1sGh80eE3jzVwo

To claim this, I am signing this object:

View beam_opcodes.erl
-module(beam_opcodes).
%% Warning: Do not edit this file.
%% Auto-generated by 'beam_makeops'.
-export([format_number/0]).
-export([opcode/2,opname/1]).
-spec format_number() -> 0.
format_number() -> 0.
@scrogson
scrogson / assigns.rs
Created Jul 10, 2017
Assigns like Plug's conn.assigns - but type safe
View assigns.rs
use ::std::collections::HashMap;
use ::std::any::{TypeId, Any};
struct Assigns {
map: HashMap<TypeId, Box<Any>>,
}
trait AssignHandle {
type MapsTo;
}
@scrogson
scrogson / router.rs
Created Jul 8, 2017
Basic Rust HTTP Router
View router.rs
#![allow(dead_code)]
use std::collections::HashMap;
type Headers = HashMap<String, String>;
type BoxedCallback = Box<Fn(Conn) -> Conn>;
#[derive(Default)]
struct Request {
method: String,
url: String,
You can’t perform that action at this time.