Skip to content

Instantly share code, notes, and snippets.

Rusting it up

Jerome Gravel-Niquet jeromegn

Rusting it up
View GitHub Profile
View gist:c56f42ef53d0bc80f679c4506d270e2c
async fn transfer(inbound: MeteredIO, outbound: MeteredIO) -> Result<(), Error>
let (mut ri, mut wi) = tokio::io::split(inbound);
let (mut ro, mut wo) = tokio::io::split(outbound);
let mut client_to_server = ri.copy(&mut wo).fuse();
let mut server_to_client = ro.copy(&mut wi).fuse();
loop {
futures::select! {
View gist:9f5fb90ac209ccc6fe91e5202b92fcdf
error[E0308]: mismatched types
--> src/handlers/
159 | tokio::spawn(super::proxy_tcp(
| ^^^^^^^^^^^^ one type is more general than the other
= note: expected type `futures_util::future::map::Map<tokio_io::io::shutdown::Shutdown<'_, _>, _>`
found type `futures_util::future::map::Map<tokio_io::io::shutdown::Shutdown<'_, _>, _>`
jeromegn / xdp_load_balancer.c
Created Oct 8, 2019 — forked from summerwind/xdp_load_balancer.c
XDP based load balancer with L3DSR support
View xdp_load_balancer.c
#define KBUILD_MODNAME "load_balancer"
#include <uapi/linux/bpf.h>
#include <linux/in.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
BPF_HASH(counter, uint32_t, long);
View crng.go
package main
import (
View messages.rb
class Messages
include Enumerable
attr_reader :messages
delegate :each, to: :messages
def initialize(messages = {}) # hash of error messages
@messages = messages
def full_messages
jeromegn / basic.ecr
Created Feb 7, 2016
Slang -> ECR -> HTML
View basic.ecr
<span id="some-id" class="classname">
<div id="hello" class="world world2">
<span data-some-var="<%= some_var %>">
<span class="deep_nested">
<%= %>
<span class="alongside" pid="<%= %>">

Keybase proof

I hereby claim:

  • I am jeromegn on github.
  • I am jerome ( on keybase.
  • I have a public key whose fingerprint is 0638 8CB6 C529 1977 7911 A36A FAF6 2F81 F60B 40B8

To claim this, I am signing this object:

View component.hbs
<div class="red-square" id="{{id}}-red-square">
.red-square {
background-color: red;
jeromegn / index.html
Created Mar 20, 2012 — forked from benjchristensen/index.html
Animated Line Graphs / Sparklines using SVG Path and d3.js
View index.html
<title>Animated Sparkline using SVG Path and d3.js</title>
<script src=""></script>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
jeromegn / index.html
Created Mar 16, 2012
Activity on map
View index.html
<!DOCTYPE html>
<script src=""></script>
<style type="text/css">
svg {
background: #222;
width: 960px;