Skip to content

Instantly share code, notes, and snippets.

@brucespang
brucespang / tcp_none.c
Created March 11, 2020 22:54
Kernel module that does no congestion control
/* Specifically does not do congestion control
*
* Bruce Spang <[email protected]>
*/
#include <linux/module.h>
#include <net/tcp.h>
// TODO: tried to use TCP_INFINITE_SSTHRESH here, but it's too large and
// somehow this causes problems. This seems fine for me, would like something a little

Keybase proof

I hereby claim:

  • I am brucespang on github.
  • I am bspang (https://keybase.io/bspang) on keybase.
  • I have a public key ASB5Vg1D0KCGM12DB8Pq5ujOhkCivYuXPYVSe2sppZxIXwo

To claim this, I am signing this object:

@brucespang
brucespang / simplex_projection.py
Created June 23, 2016 19:11 — forked from daien/simplex_projection.py
Compute Euclidean projections on the simplex or L1-ball
""" Module to compute projections on the positive simplex or the L1-ball
A positive simplex is a set X = { \mathbf{x} | \sum_i x_i = s, x_i \geq 0 }
The (unit) L1-ball is the set X = { \mathbf{x} | || x ||_1 \leq 1 }
Adrien Gaidon - INRIA - 2011
"""
bspang@ubuntu:~/code/cs630/remodel$ make
clang -I. -g -Wall -Wextra -Werror -c src/remodel.c -o build/remodel.o
0 libLLVM-3.0.so.1 0x00002b006eb5bfcf
1 libLLVM-3.0.so.1 0x00002b006eb5c591
2 libpthread.so.0 0x00002b006f47ecb0
3 clang 0x0000000000dd89d4
4 clang 0x0000000000ddbed0 clang::SourceManager::getLineNumber(clang::FileID, unsigned int, bool*) const + 480
5 clang 0x0000000000de093c clang::SourceManager::getPresumedLoc(clang::SourceLocation) const + 396
6 clang 0x00000000006f4785 clang::CodeGen::CGDebugInfo::getOrCreateFile(clang::SourceLocation) + 53
7 clang 0x00000000006fe8dd clang::CodeGen::CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable*, clang::VarDecl const*) + 45
@brucespang
brucespang / gist:6097690
Last active December 20, 2015 07:59
raft example
var id = "" + randBetween(0,100);
console.log("starting as " + id)
cfg = {
host: 'localhost',
port: 9000
}
var peer = new Peer(id, cfg);
peer.on("error", function(err) {
peer = new Peer(room_id + "-" + ..., cfg);
@brucespang
brucespang / building
Created November 23, 2011 02:51
Gluon on OS X
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
$ make
$ sudo make install
@brucespang
brucespang / alure.rb
Created November 22, 2011 13:38
Alure Formula
require 'formula'
class Alure < Formula
url 'http://kcat.strangesoft.net/alure-releases/alure-1.2.tar.bz2'
homepage 'http://kcat.strangesoft.net/alure.html'
md5 '3088aba074ad02d95ea51e705053b9f5'
depends_on 'cmake'
def install
@brucespang
brucespang / vim.rb
Created October 31, 2011 10:10 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
# Get stable versions from hg repo instead of downloading an increasing
# number of separate patches.
url 'https://vim.googlecode.com/hg/', :revision => '992b24149a9e'
version '7.3.333'
homepage 'http://www.vim.org/'
head 'https://vim.googlecode.com/hg/'
@brucespang
brucespang / status_codes.php
Created September 21, 2010 01:56
List of status codes and their messages php
// List of status codes for ease of mapping $status
$status_codes = array(
// Informational 1xx
100 => 'Continue',
101 => 'Switching Protocols',
// Successful 2xx
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
#!/usr/bin/env ruby
if ARGV.length < 1
puts "Usage: ruby fixed2fluid.rb FIXED_CSS_FILE [NEW_FLUID_CSS_FILE]"
else
if File.file?(ARGV[0])
if ARGV.length == 1
fixed = File.open(ARGV[0], "r")
else
fixed = File.open(ARGV[0], "r")