Skip to content

Instantly share code, notes, and snippets.

View sdressler's full-sized avatar

Sebastian Dressler sdressler

View GitHub Profile
@fragsalat
fragsalat / proxy.rs
Created November 28, 2019 15:24
A simple and lightweight multi threaded TCP proxy written in Rust language. Not using any 3rd-party libraries but just standard libraries.
use std::net::{TcpListener, SocketAddr, TcpStream, Shutdown, SocketAddrV4, Ipv4Addr};
use std::str::FromStr;
use std::thread::{spawn, JoinHandle};
use std::io::{BufReader, BufWriter, Read, Write};
fn pipe(incoming: &mut TcpStream, outgoing: &mut TcpStream) -> Result<(), String> {
let mut buffer = [0; 1024];
loop {
match incoming.read(&mut buffer) {
Ok(bytes_read) => {
@Alexis-D
Alexis-D / psort.c
Created February 27, 2012 11:20
Parallel Radix Sort with OpenMP
#include <stdlib.h>
#include <string.h>
#define INITIAL_SHIFT (((sizeof (long long)) - 1) * 010)
#define NTHREADS 64
#define SWITCH_TO_INSERTION 16
#define SWITCH_TO_QSORT 8192
#define DO_NOT_RADIX 2626144
/*