This file contains hidden or 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/fakeroot /bin/bash | |
| set -o errexit | |
| set -o nounset | |
| set -o pipefail | |
| OUTFILE=$2.squashfs | |
| TMPDIR=$(mktemp -d -p .) | |
| cleanup() { | |
| rm -fr $TMPDIR | |
| } |
This file contains hidden or 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
| from fractions import Fraction as f | |
| def factors_of_two(n): | |
| return n & ~(n - 1) | |
| def _tokens_slice(count, zones): | |
| # We cannot have zones be a multiple of two and also have tokens with | |
| # equal spacing from each other. |
This file contains hidden or 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
| @contextmanager | |
| def atomic_temporary_file(destination, *, mode="w+b", flags=0, **kwargs): | |
| fd = os.open(destination.parent, os.O_TMPFILE | os.O_RDWR | flags) | |
| with io.open(fd, mode, **kwargs) as fh: | |
| yield fh | |
| os.link("/proc/self/fd/{}".format(fd), str(destination), src_dir_fd=0) |
This file contains hidden or 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 <arpa/inet.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <sys/types.h> | |
| #include <sys/socket.h> | |
| #include <sys/un.h> | |
| #include <time.h> | |
| #include <unistd.h> | |
| #include <sys/resource.h> |
This file contains hidden or 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
| $ sudo -u cassandra jstat -gcutil $(pgrep -f Cassandra) 100ms | |
| S0 S1 E O M CCS YGC YGCT FGC FGCT GCT | |
| 0.00 100.00 100.00 100.00 97.96 95.10 21 8.678 11 140.498 149.176 | |
| 0.00 100.00 100.00 100.00 97.96 95.10 21 8.678 11 140.498 149.176 | |
| 0.00 100.00 100.00 100.00 97.96 95.10 21 8.678 11 140.498 149.176 |
This file contains hidden or 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 | |
| # Depends on zstd (>1.3.6) and aws-cli | |
| set -o errexit | |
| set -o nounset | |
| set -o pipefail | |
| # Set kernel.core_pattern = | coredump_uploader.sh %P %s %E | |
| PID=$1 | |
| shift | |
| SIGNAL=$1 |
This file contains hidden or 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
| from botocore.session import Session | |
| credentials_cache = dict() | |
| class Session(Session): | |
| def __init__(self, role_arn, *args, **kwargs): | |
| super().__init__(*args, **kwargs) | |
| self._config = dict( | |
| profiles=dict( | |
| default=dict( |
This file contains hidden or 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
| from aiohttp.client_exceptions import ClientError | |
| import asyncio | |
| from asyncio import Queue | |
| from aiohttp.resolver import AsyncResolver | |
| import json | |
| import os | |
| import random | |
| from blake3 import blake3 | |
| from hashlib import md5 | |
| from socket import socketpair |
This file contains hidden or 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
| josh@ubuntu:~/hasher$ dd if=/dev/zero bs=65536 count=16384 | ./xxHash/xxh128sum | |
| 16384+0 records in | |
| 16384+0 records out | |
| 16024760318c6298efd1151033ad2e9f stdin | |
| 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.23966 s, 4.5 GB/s | |
| josh@ubuntu:~/hasher$ dd if=/dev/zero bs=65536 count=16384 | ./a.out | |
| 16384+0 records in | |
| 16384+0 records out | |
| 1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.210685 s, 5.1 GB/s | |
| 16024760318c6298efd1151033ad2e9f |
This file contains hidden or 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
| - This run was on a c5.large which had been booted up before | |
| - Set MODULES=dep in /etc/initramfs-tools/initramfs.conf | |
| - Deleted a bunch of initramfs-tools hooks, including especially: iscsi mdadm lvm2 | |
| - Removed a bunch of stock ubuntu services | |
| * snapd | |
| * ec2-instance-connect | |
| * cryptsetup-initramfs | |
| * udisks2 | |
| * unattended-upgrades | |
| * plymouth |