Skip to content

Instantly share code, notes, and snippets.

Permanent 418 status code.

Jon Gjengset jonhoo

Block or report user

Report or block jonhoo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jonhoo / userChrome.css
Created Jun 5, 2018
Firefox tabs-on-bottom
View userChrome.css
@namespace url("");
/* 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 / packet-generator.cpp
Created Dec 4, 2013
Complete example code showing how to construct a UDP packet from scratch and inject it on a WiFi interface in Linux
View packet-generator.cpp
* Hello, and welcome to this brief, but hopefully complete, example file for
* wireless packet injection using pcap.
* Although there are various resources for this spread on the web, it is hard
* to find a single, cohesive piece that shows how everything fits together.
* This file aims to give such an example, constructing a fully valid UDP packet
* all the way from the 802.11 PHY header (through radiotap) to the data part of
* the packet and then injecting it on a wireless interface
jonhoo /
Created Apr 19, 2019
A timerfd based implementation of a timer future for tokio
struct OneShotTimer {
fd: Box<std::os::unix::io::RawFd>,
e: Option<tokio_reactor::PollEvented<mio::unix::EventedFd<'static>>>,
impl OneShotTimer {
fn new(d: time::Duration) -> io::Result<Self> {
if d.as_secs() == 0 && d.subsec_nanos() == 0 {
// this would be interpreted as "inactive timer" by timerfd_settime
return Ok(OneShotTimer {
#!/usr/bin/env run-cargo-script
//! ```cargo
//! [dependencies]
//! tokio = "0.1"
//! hyper = "0.12"
//! futures = "0.1"
//! tower-service = { git = "" }
//! tower-buffer = { git = "" }
//! ```
extern crate futures;
jonhoo /
Last active Oct 22, 2018
Distributed RWMutex in Go
extern crate async_bincode;
extern crate futures;
extern crate serde;
extern crate serde_derive;
extern crate bincode;
extern crate tokio;
extern crate tower_service;
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 / 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/
#1 0x000055e6e56d7d3c in std::sys::unix::condvar::Condvar::wait (self=0x7faf9ae51130, mutex=0x7faf9ae51100)
at /checkout/src/libstd/sys/unix/
#2 0x000055e6e56d7ce6 in std::sys_common::condvar::Condvar::wait (self=0x7faf9ae51130, mutex=0x7faf9ae51100)
at /checkout/src/libstd/sys_common/
#3 0x000055e6e56d458a in std::sync::condvar::Condvar::wait (self=0x7faf9afaade8, guard=...)
at /checkout/src/libstd/sync/
#4 0x000055e6e56d0047 in futures::task_impl::std::ThreadNotify::park (self=0x7faf9afaadd0)
at /home/jon/.cargo/registry/src/
#5 0x000055e6e55f30f6 in futures::task_impl::std::<impl futures::task_impl::Spawn<F>>::wait_future::{{closure}} (
You can’t perform that action at this time.