Skip to content

Instantly share code, notes, and snippets.

🤦‍♂️
Permanent 418 status code.

Jon Gjengset jonhoo

View GitHub Profile
View hyper-tower-buffer.rs
#!/usr/bin/env run-cargo-script
//! ```cargo
//! [dependencies]
//! tokio = "0.1"
//! hyper = "0.12"
//! futures = "0.1"
//! tower-service = { git = "https://github.com/tower-rs/tower.git" }
//! tower-buffer = { git = "https://github.com/tower-rs/tower.git" }
//! ```
extern crate futures;
View at-a-time-service.rs
extern crate async_bincode;
#[macro_use]
extern crate futures;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate bincode;
extern crate tokio;
extern crate tower_service;
@jonhoo
jonhoo / discord-legibility.css
Last active Jul 6, 2018
Stylesheet for making Discord Light at least somewhat easier to read
View discord-legibility.css
.message-group .comment .markup, .chat {
color: inherit;
}
.message-group.compact .message .timestamp {
color: #555;
float: right;
}
.reaction .reaction-count {
color: inherit;
View dropping-runtime.txt
#0 0x00007fafb46f7ffc in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1 0x000055e6e56d7d3c in std::sys::unix::condvar::Condvar::wait (self=0x7faf9ae51130, mutex=0x7faf9ae51100)
at /checkout/src/libstd/sys/unix/condvar.rs:78
#2 0x000055e6e56d7ce6 in std::sys_common::condvar::Condvar::wait (self=0x7faf9ae51130, mutex=0x7faf9ae51100)
at /checkout/src/libstd/sys_common/condvar.rs:51
#3 0x000055e6e56d458a in std::sync::condvar::Condvar::wait (self=0x7faf9afaade8, guard=...)
at /checkout/src/libstd/sync/condvar.rs:214
#4 0x000055e6e56d0047 in futures::task_impl::std::ThreadNotify::park (self=0x7faf9afaadd0)
at /home/jon/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.21/src/task_impl/std/mod.rs:536
#5 0x000055e6e55f30f6 in futures::task_impl::std::<impl futures::task_impl::Spawn<F>>::wait_future::{{closure}} (
@jonhoo
jonhoo / userChrome.css
Created Jun 5, 2018
Firefox tabs-on-bottom
View userChrome.css
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* tabs on bottom of window */
#navigator-toolbox { -moz-box-ordinal-group: 10; }
#TabsToolbar { -moz-box-ordinal-group: 10; }
#PopupAutoCompleteRichResult {
margin-top: -35vh;
/*
position: fixed;
bottom: 74px;
@jonhoo
jonhoo / blacklist-ca-certs.sh
Created May 12, 2018
Scripts for managing SSL blacklist
View blacklist-ca-certs.sh
#!/usr/bin/bash
echo "==> Clear blacklist"
sudo rm /etc/ca-certificates/trust-source/blacklist/*.pem
echo "==> Regenerate CA list"
sudo update-ca-trust
echo "==> Blacklisting all"
for f in /etc/ca-certificates/extracted/cadir/*.pem; do
sudo cp "$f" "/etc/ca-certificates/trust-source/blacklist/$(basename "$f")"
done
@jonhoo
jonhoo / raft.go
Created Mar 16, 2016
Raft pseudocode
View raft.go
// This file gives pseudocode for the complete operation of a Raft peer,
// including the fast backtracking optimization. The implementation here is
// currently 0-indexed, as this simplifies the implementation in many cases.
// This implementation also does not discuss locks at all, which will be vital
// in any real implementation.
//
// ============================================================================
// The following data needs to be persisted
// ============================================================================
@jonhoo
jonhoo / go-test-many.sh
Last active Mar 5, 2016
Script for running go tests many times in parallel, printing the current status, and logging errors
View go-test-many.sh
#!/bin/bash
#
# Script for running `go test` a bunch of times, in parallel, storing the test
# output as you go, and showing a nice status output telling you how you're
# doing.
#
# Normally, you should be able to execute this script with
#
# ./go-test-many.sh
#
@jonhoo
jonhoo / README.md
Last active Oct 22, 2018
Distributed RWMutex in Go
View README.md
You can’t perform that action at this time.