Skip to content

Instantly share code, notes, and snippets.

🤦‍♂
Permanent 418 status code.

Jon Gjengset jonhoo

🤦‍♂
Permanent 418 status code.
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
View podcast.xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
>
<channel>
<atom:link href="{{ site.url }}{{ page.url }}" rel="self" type="application/rss+xml" />
<link>{{ site.url }}</link>
View googleplay-podcast-sample-feed.xml
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" version="2.0">
<channel>
<title>The Unknown Podcast</title>
<link>http://sample.com/podcasts/unknown/index.html</link>
<language>en-us</language>
<copyright>℗ 2025 Unknown Podcaster Corp</copyright>
<googleplay:author>Unannounced Podcaster</googleplay:author>
<googleplay:description>The Unknown Podcast will look at all the things that are unknown or unknowable. Find us on Google Play Music!</googleplay:description>
<description>The Unknown Podcast will look at all the things that are unknown or unknowable.</description>
@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;
View trace-timing-through-buffer
view-request::submit request:
mean: 5.3µs, p50: 8µs, p90: 16µs, p99: 24µs, p999: 24µs, max: 24µs, #: 34
1µs | ************************************ | 88.2th %-ile
2µs | | 88.2th %-ile
4µs | | 88.2th %-ile
8µs | | 88.2th %-ile
16µs | **** | 97.1th %-ile
view-request::waiting for service readiness:
mean: 1404.2µs, p50: 1466µs, p90: 1859µs, p99: 3670µs, p999: 3670µs, max: 3670µs, #: 34
64µs | ** | 2.9th %-ile
View tower-buffer-trace.diff
diff --git a/tower-buffer/Cargo.toml b/tower-buffer/Cargo.toml
index 328a0c7..4728c9e 100644
--- a/tower-buffer/Cargo.toml
+++ b/tower-buffer/Cargo.toml
@@ -21,12 +21,17 @@ Buffer requests before dispatching to a `Service`.
categories = ["asynchronous", "network-programming"]
edition = "2018"
+[features]
+log = ["tracing/log"]
@jonhoo
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
*
View compile-errors
| cargo t
Compiling hdrhistogram v6.1.1
Compiling crossbeam-deque v0.7.1
Compiling rand v0.6.5
Compiling parking_lot v0.6.4
Compiling hdrsample v6.0.3
Compiling tower-spawn-ready v0.1.0 (/home/jon/dev/others/tower/tower-spawn-ready)
Compiling tower-limit v0.1.0
Compiling tower-load v0.1.0 (/home/jon/dev/others/tower/tower-load)
error[E0277]: the trait bound `tokio_sync::oneshot::error::RecvError: std::error::Error` is not satisfied
@jonhoo
jonhoo / tokio-timer-fd.rs
Created Apr 19, 2019
A timerfd based implementation of a timer future for tokio
View tokio-timer-fd.rs
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 {
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;
You can’t perform that action at this time.