This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// extern crate take5; | |
// extern crate remote; | |
use std::io::{Read, Write}; | |
use std::net::{SocketAddr, TcpStream, TcpListener, Shutdown}; | |
use std::thread; | |
use std::time::Duration; | |
use std::sync::{Arc, Mutex}; | |
// use take5::player::AiPlayer; | |
// use remote::Client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::marker::PhantomData; | |
use std::iter::Peekable; | |
use std::io::{Read, Bytes}; | |
use serde::Deserialize; | |
use serde_json as json; | |
use serde_json::error::Error as JsonError; | |
/// Iterator over parsed Messages. | |
pub struct DeserializeIter<T: Deserialize, R: Read> { | |
bytes: Peekable<Bytes<R>>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ssid=$(networksetup -getairportnetwork en0 | cut -d ":" -f 2 | sed "s/^[ \t]*//") | |
sudo airport -z | |
sudo ifconfig en0 ether $(openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.\$//") | |
networksetup -setairportnetwork en0 "$ssid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(ip_addr, raw)] | |
extern crate pnet; | |
use std::net::{IpAddr, Ipv4Addr}; | |
use pnet::transport::TransportChannelType::Layer4; | |
use pnet::transport::TransportProtocol::Ipv4; | |
use pnet::transport::transport_channel; | |
use pnet::packet::ip::IpNextHeaderProtocols; | |
use pnet::packet::Packet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! try_or { | |
($expr:expr => $handler:expr) => (match $expr { | |
::std::result::Result::Ok(v) => v, | |
::std::result::Result::Err(e) => { | |
warn!("{}", e); | |
$handler | |
} | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.global _start | |
_start: | |
movl $foo,%edx | |
movl $string,%ecx | |
movl $1,%ebx | |
movl $4,%eax | |
int $0x80 | |
movl $0,%ebx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Harmonic</title> | |
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
</head> | |
<body> | |
<canvas id="harmonic"></canvas> | |
<script type="text/javascript"> | |
$(document).ready(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pry' | |
require 'json' | |
json = JSON.parse(`curl https://api.github.com/users/nixpulvis/repos?per_page=100`) | |
json.each do |repo| | |
if File.exists?(repo['name']) | |
Dir.chdir(repo['name']) | |
print "Pulling #{repo['name']}... " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Contract is one of: | |
# - Proc (Any -> Boolean) | |
# - Hash { Contract => Contract } | |
def assert_predicate(predicate, value) | |
if predicate.(value) | |
value | |
else | |
fail "contract error" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
;; A Contract is one of: | |
;; - Any -> Boolean | |
;; - Signature | |
;; A Signature is a (signature Contract Contract) | |
(struct signature (domain range)) | |