export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep -v ^$ | while read x; do echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done
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
function remove-docker-containers | |
echo "Stop running shit" | |
docker stop (docker ps -q) | |
echo "Remove the whale shit" | |
docker rm (docker ps -a -q) | |
end | |
function remove-docker-images | |
remove-docker-containers |
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
// Here is an extremely simple version of work scheduling for multiple | |
// processors. | |
// | |
// The Problem: | |
// We have a lot of numbers that need to be math'ed. Doing this on one | |
// CPU core is slow. We have 4 CPU cores. We would thus like to use those | |
// cores to do math, because it will be a little less slow (ideally | |
// 4 times faster actually). | |
// | |
// The Solution: |
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 <sys/socket.h> | |
#include <sys/un.h> | |
#include <sys/event.h> | |
#include <netdb.h> | |
#include <assert.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <errno.h> |
I've put together these notes as I read about DHT's in depth and then learned how the libtorrent implementation based on the Kademlia paper actually works.
400,000,000,000
(400 billion stars), that's a 4 followed by 11 zeros.
The number of atoms in the universe is estimated to be around 10^82
.
A DHT with keys of 160 bits, can have 2^160
possible numbers, which is around 10^48