Skip to content

Instantly share code, notes, and snippets.

Avatar

apiraino

View GitHub Profile
View broken heart
use warp::Filter;
#[derive(Debug)]
pub enum Error {
RejectWith401,
}
impl warp::reject::Reject for Error {}
fn get_token_or_401() -> impl Filter<Extract = (String,), Error = warp::Rejection> + Clone {
warp::header::<String>("Authorization").and_then(move |header_name: String| async move {
@apiraino
apiraino / locustfile.py
Last active Apr 10, 2020 — forked from reallistic/locustfile.py
Websocket client for locust.io (SockJS)
View locustfile.py
# Run with
# $ locust -H ws-server:port -P 8080 -f locustfile.py
# then open the browser on localhost:8080
# requirements.txt
# locust==0.0
# locustio==0.14.5
# websocket==0.2.1
import time
View gist:3d10444cbc2f0a529972a13fb2d6a60c
<html>
<head>
<title>Cargo Build Timings — open-taffeta 0.4.1</title>
<meta charset="utf-8">
<style type="text/css">
html {
font-family: sans-serif;
}
@apiraino
apiraino / AuthService.php
Last active Mar 31, 2020
Simple static token authentication with Directus API
View AuthService.php
<?php
declare(strict_types=1);
use Directus\Services\AuthService as DirectusAuthService;
use Directus\Authentication\Exception\UserNotFoundException;
class AuthService
{
private function getToken($req)
@apiraino
apiraino / Dockerfile
Created Jan 27, 2020
Dockerfile test to build all Sway things
View Dockerfile
FROM ubuntu:19.10
MAINTAINER apiraino "github.com/apiraino"
# DONT USE THIS, IT DOESNT (yet) WORK
# Instructions
# docker build -t "swaywm:builder" .
# docker run --rm -v /tmp/sway-compiled:/export -it "swaywm:builder" bash
# then inside the container run "cp -r sway-src/* /export"
# You'll find the build outside the container in "/tmp/sway-compiled"
@apiraino
apiraino / gist:f7ac1852c230b6de9b76171520d29dc4
Last active Sep 8, 2019
Hide Explore Repositories on Github
View gist:f7ac1852c230b6de9b76171520d29dc4
// ==UserScript==
// @name Hide side columns on Github
// @namespace https://gist.github.com/apiraino/f7ac1852c230b6de9b76171520d29dc4
// @version 0.1
// @description Hide side columns on Github
// @author apiraino
// @match https://github.com/
// @grant none
// @run-at document-start
// @inject-into content
@apiraino
apiraino / config.yml
Last active Aug 17, 2019
Rust stable CircleCI config file (with sccache + rustfmt + clippy)
View config.yml
version: 2.1
commands:
install-system-deps:
steps:
- run:
name: Apt get stuff
command: |
# for codecov
# sudo apt install -y libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc binutils-dev libiberty-dev
sudo apt install memcached -y
@apiraino
apiraino / ckb-testnet-first-run.md
Last active May 26, 2019
CKB testnet first run
View ckb-testnet-first-run.md

Testing CKB testnet

Following these install instructions (very well detailed!) https://docs.nervos.org/getting-started/run-node

Trying the precompiled binaries

SSL 1.1.x not supported therefore Ubuntu 19.04 cannot run the precompiled binaries: will file an issue.

Can't easily install an obsolete OpenSSL version on Ubuntu 19.04

View gist:505a485bd6ac4536279d2f528245284d
fn delay_future() -> Box<Future<Item = (), Error = io::Error> + Send> {
let wait_time = Duration::from_millis(100);
let now = Instant::now();
let task = Interval::new(now, wait_time)
.map_err(|e| panic!("interval errored; err={:?}", e))
.take(10)
.for_each(|instant| {
println!("fire; instant={:?}", instant);
Ok(())
});
You can’t perform that action at this time.