Skip to content

Instantly share code, notes, and snippets.

View abalmos's full-sized avatar

Andrew Balmos abalmos

  • Purdue University and The Qlever Company, LLC
  • West Lafayette, IN
View GitHub Profile
@abalmos
abalmos / main.rs
Created January 9, 2020 19:44
Authorization header struct
use async_std;
use surf::get;
pub enum Authorization {
Basic(String),
Bearer(String),
}
impl Authorization {
pub fn basic(username: &str, password: &str) -> Self {
@abalmos
abalmos / app.js
Created January 5, 2020 19:52
binary via cacahe ?
import { pipeline } from 'stream';
import { promisify } from 'util';
const pipelineAsync = promisify(pipeline);
import * as express from 'express';
import * as ash from 'express-async-handler';
import * as uuid from 'uuid/v4';
import * as cacache from 'cacache';
const CACHE_PATH = "/tmp/oada-cache"; // This should come from the config
@abalmos
abalmos / Cargo.toml
Created November 20, 2019 20:29
Using tokio-postgres with async-std runtime
[package]
name = "async-std-tokio-postgres"
version = "0.1.0"
authors = ["Andrew Balmos <andrew@balmos.org>"]
edition = "2018"
[dependencies]
tokio-postgres = { version = "0.5.0-alpha.1", default-features = false }
futures = "0.3.1"
futures-util = "0.4.1"
@abalmos
abalmos / module.js
Last active February 8, 2016 20:32
Using input to achieve context without "module"
import signal from './signal.js'
export default (options = {}) => {
return (module) => {
module.addSignals({
signal: signal(['optional', 'context', 'override'])
});
}
}