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
diff --git a/reflector.rb b/reflector.rb | |
index c47370b..39e4115 100644 | |
--- a/reflector.rb | |
+++ b/reflector.rb | |
@@ -4,12 +4,17 @@ | |
# sudo ip link set tap-e up | |
# sudo ip route add 10.1.2.0/24 via 10.1.2.3 | |
+require "fiber_scheduler" | |
require "./tun" |
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
require 'rack' | |
counter = 0 | |
Thread.new do | |
loop do | |
puts "hello, #{counter}" | |
counter += 1 | |
sleep 1 | |
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
n = 200 | |
m = 63 | |
q = 16 | |
c = 0 | |
1_000_000.times do | |
buckets = Array.new(m, 0) | |
n.times do | |
slot = rand(m) | |
buckets[slot] += 1 |
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
#define _GNU_SOURCE | |
#include <assert.h> | |
#include <limits.h> | |
#include <netinet/in.h> | |
#include <netinet/tcp.h> | |
#include <pthread.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <unistd.h> |
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
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define WIDTH (99 * 40) | |
#define HEIGHT (99 * 25) | |
static double timespec2d(struct timespec *ts) | |
{ |
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
/* | |
* NAME: injectaddr.so | |
* | |
* SYSOPSIS: | |
* % gcc -shared -fPIC injectaddr.c -ldl -o injectaddr.so | |
* | |
* -- inject 1s delay, then connect to 127.0.0.1:8888 | |
* % LD_PRELOAD=injectaddr.so \ | |
* curl http://d1000.p8888.4127-0-0-1.inject.example.com/ | |
* |
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 strict; | |
use warnings; | |
use File::Temp qw(tempdir); | |
use Getopt::Long; | |
use POSIX qw(:sys_wait_h); | |
my $jobs = 1; | |
GetOptions( | |
"jobs=i" => \$jobs, |
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
#! perl | |
use strict; | |
use warnings; | |
my $lines_to_pick = 5; # 何行選ぶか | |
my $lines_total = 0; | |
my @picked; |
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
#include <errno.h> | |
#include <fcntl.h> | |
#include <spawn.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#define USE_O_CLOEXEC 1 |
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
/* | |
* Copyright (c) 2021 Fastly, Inc., Kazuho Oku | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to | |
* deal in the Software without restriction, including without limitation the | |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
* sell copies of the Software, and to permit persons to whom the Software is | |
* furnished to do so, subject to the following conditions: | |
* |