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/tcp.rs:159:5
|
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
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 (
"fmt"
"io/ioutil"
"os"
"strconv"
"syscall"
"time"
"unsafe"
View messages.rb
class Messages
include Enumerable
attr_reader :messages
delegate :each, to: :messages
def initialize(messages = {}) # hash of error messages
@messages = messages
end
def full_messages
@jeromegn
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>
<span class="deep_nested">
<%= Process.pid %>
</span>
</span>
</span>
<span class="alongside" pid="<%= Process.pid %>">
View keybase.md

Keybase proof

I hereby claim:

  • I am jeromegn on github.
  • I am jerome (https://keybase.io/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">
</div>
<style>
.red-square {
background-color: red;
}
</style>
<script>
@jeromegn
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
<html>
<head>
<title>Animated Sparkline using SVG Path and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
@jeromegn
jeromegn / index.html
Created Mar 16, 2012
Activity on map
View index.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://mbostock.github.com/d3/d3.js"></script>
<style type="text/css">
svg {
background: #222;
width: 960px;
You can’t perform that action at this time.