Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation for 10 days, back on 22/07/2019

Yoshua Wuyts yoshuawuyts

🌴
On vacation for 10 days, back on 22/07/2019
Block or report user

Report or block yoshuawuyts

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
@yoshuawuyts
yoshuawuyts / playground.rs
Created Jul 22, 2019 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
#![feature(async_await)]
use std::{cell::Cell, future::Future, io, net::SocketAddr, pin::Pin};
pub trait TcpStream {}
impl<T: TcpStream + ?Sized> TcpStream for Pin<Box<T>> {}
pub trait Runtime: Send + Sync + 'static {
type TcpStream: TcpStream;
@yoshuawuyts
yoshuawuyts / playground.rs
Created Jul 22, 2019 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
#![feature(async_await)]
use std::{cell::Cell, future::Future, io, net::SocketAddr, pin::Pin};
pub trait TcpStream {}
impl<T: TcpStream + ?Sized> TcpStream for Pin<Box<T>> {}
pub trait Runtime: Send + Sync + 'static {
type TcpStream: TcpStream;
@yoshuawuyts
yoshuawuyts / arch-linux-install.md
Created May 19, 2019 — forked from jamesmunns/arch-linux-install.md
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
View arch-linux-install.md
View std-features-lacking.rs
// required
let listener = TcpListener::bind((args.address.as_str(), args.port))?;
// what we want to be able to do
let listener = TcpListener::bind((&args.address, args.port))?;
View migrate-futures.sh
#!/bin/bash
set +ex
fr() {
rg -l "$1" | xargs sed -i "s/$1/$2/g"
}
# setup
fr 'atomic_waker' 'atomic_cx'
View udp-echo.js
#!/usr/local/bin/node
let dgram = require('dgram')
let socket = dgram.createSocket('udp4', (msg, rinfo) => {
let peer = `${rinfo.address}:${rinfo.port}`
socket.send(msg, peer, (err) => {
if (err) peer.close()
console.log(`Sent ${rinfo.size} of ${rinfo.size} bytes to ${peer}`)
})
View quote-problems.md

Current

error: only the main function can be tagged with #[foob]
  --> tests/hello.rs:45:1
   |
45 | fn hello() {
   | ^^
error: aborting due to previous error
error: Could not compile `runtime`.
To learn more, run the command again with --verbose.                                                                                                                   [runtime:1]
View tide-improvements.rs
let config = Config::from_args();
let mut app = tide::App::new(())
.address(config.address)
.port(config.port);
app.at("/").get(reply);
app.serve();
View current.rs
fn main() -> io::Result<()> {
executor::block_on(async {
let listener = TcpListener::bind(&"127.0.0.1:7878".parse().unwrap())?;
let mut incoming = listener.incoming();
while let Some(stream) = await!(incoming.next()) {
let stream = stream?;
let addr = stream.peer_addr()?;
juliex::spawn(async move {
let (mut reader, mut writer) = stream.split();
View bbox.rs
#[derive(StructOpt, PartialEq, Debug)]
pub struct Cli {
bbox_1: u32,
bbox_2: u32,
bbox_3: u32,
bbox_4: u32,
}
fn main () {
let args = Cli::from_args();
You can’t perform that action at this time.