Skip to content

Instantly share code, notes, and snippets.

View GGist's full-sized avatar

GGist

  • Founder @ Arktos Ag
  • Seattle, WA
View GitHub Profile
@GGist
GGist / udp_reuseaddr.rs
Last active August 29, 2015 14:18
Binding A UdpSocket As SO_REUSEADDR To Listen On A Multicast Address (UPnP)
#![feature(udp, ip_addr, libc)]
extern crate libc;
use std::io::{Result, Error, ErrorKind};
use std::net::{UdpSocket, ToSocketAddrs, SocketAddr, Ipv4Addr, IpAddr};
use std::mem;
#[cfg(windows)]
pub type SockT = libc::SOCKET;
@GGist
GGist / receiver.c
Last active August 29, 2015 14:21
Multicast On Multiple Interfaces
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <mswsock.h>
#include <stdio.h>
int main() {
WSADATA wsaData;
@GGist
GGist / main.rs
Last active October 11, 2015 01:35
Playing WAV In rust-sdl2
extern crate sdl2;
use std::thread::{self};
use sdl2::{Sdl};
use sdl2::audio::{self, AudioSpecDesired, AudioSpecWAV, AudioCallback, AudioDevice};
//----------------------------------------------------------------------------//
struct CopiedData {
@GGist
GGist / Cargo.toml
Created December 22, 2015 08:13
Command Line DHT Search Example (bip_dht)
[package]
name = "testing"
version = "0.1.0"
[dependencies]
bip_dht = "0.2.0"
@GGist
GGist / Cargo.toml
Last active May 15, 2016 02:32
Bencode Benchmark (bip_bencode)
[package]
name = "bencode_bench"
version = "0.1.0"
[dependencies]
# Iterative
# bip_bencode = { path = "./bip_bencode", git = "https://github.com/GGist/bip-rs.git", rev = "dde80c8" }
# Recursive
bip_bencode = { path = "./bip_bencode", git = "https://github.com/GGist/bip-rs.git", rev = "f818512" }
@GGist
GGist / Cargo.toml
Created June 26, 2016 07:20
Reddit Nom Help
[package]
name = "nom-test"
version = "0.1.0"
authors = ["Andrew <[email protected]>"]
[dependencies]
nom = "1.2.0"
[package]
name = "TrackerWithHandshake"
version = "0.1.0"
authors = ["GGist <[email protected]>"]
[dependencies]
bip_handshake = "0.5"
bip_utracker = "0.3"
futures = "0.1"
tokio-core = "0.1"
+-------------------------------------------------------------------+
| |
| 13/27 16/30 |
| ^ ^ ^ ^ |
| +--++ +--+ |
| 0 4 5 6 7 8 9 12 9 26 | | |
| +--------------------------------------------+--++ |
| |XXXX||X||X||X||X||XXXX OR XXXXXXXXXXXXXXXX||XXXX| |
| +^--^--^--^--^--^--^--^----^--------------^--^--^+ |
| +--+ | | | | |--| +--------------+ +--+ |