Skip to content

Instantly share code, notes, and snippets.

View apiraino's full-sized avatar

apiraino

View GitHub Profile
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(())
});
@apiraino
apiraino / ckb-testnet-first-run.md
Last active May 26, 2019 13:19
CKB testnet first run

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

@apiraino
apiraino / config.yml
Last active August 17, 2019 09:43
Rust stable CircleCI config file (with sccache + rustfmt + clippy)
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 / gist:f7ac1852c230b6de9b76171520d29dc4
Last active September 8, 2019 16:23
Hide Explore Repositories on Github
// ==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 / Dockerfile
Created January 27, 2020 11:17
Dockerfile test to build all Sway things
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:3d10444cbc2f0a529972a13fb2d6a60c
Created March 2, 2020 10:52
cargo +nightly build -Z timings
<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 March 31, 2020 19:09
Simple static token authentication with Directus API
<?php
declare(strict_types=1);
use Directus\Services\AuthService as DirectusAuthService;
use Directus\Authentication\Exception\UserNotFoundException;
class AuthService
{
private function getToken($req)
@apiraino
apiraino / locustfile.py
Last active April 10, 2020 22:22 — forked from reallistic/locustfile.py
Websocket client for locust.io (SockJS)
# 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
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 {