Skip to content

Instantly share code, notes, and snippets.

@w41ter
w41ter / count_selectdb_ranges.py
Created August 9, 2024 09:11
Count the partition number by keys
#!/bin/bash
def decode_bytes(key):
ESCAPE_BYTE = b'\x00'
BYTES_ENDING = b'\x01'
ESCAPE_00 = b'\xff'
val = []
while len(key) > 0:
#!/bin/bash
import fdb
fdb.api_version(710)
db = fdb.open()
begin = b'\x00'
end = b'\xFF'
for key in fdb.locality.get_boundary_keys(db, begin, end):
print(key)
# encoding: utf-8
import os
import argparse
import boto3
from botocore.client import Config
if __name__ == '__main__':
parser = argparse.ArgumentParser()
@w41ter
w41ter / docker_compiler.sh
Last active April 29, 2024 07:07
A docker compiler env
#!/bin/bash cat <<EOF >build_env.dockerfile
FROM ubuntu:latest
ARG UNAME=docker
ARG UID=1000
ARG GID=1000
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
sed -i 's/archive.ubuntu.com/mirrors.cloud.tencent.com/g' /etc/apt/sources.list && \
sed -i 's/security.ubuntu.com/mirrors.cloud.tencent.com/g' /etc/apt/sources.list && \
apt-get update && \
#!/bin/bash
cat <<EOF >build_env.dockerfile
FROM debian:latest
ARG UNAME=docker
ARG UID=1000
ARG GID=1000
RUN apt update && apt install sudo
RUN groupadd -g \$GID -o \$UNAME
RUN useradd -m -u \$UID -g \$GID -o -s /bin/bash \$UNAME
#!/bin/bash
who=w41ter
server_list=()
sudo apt-get update -y
sudo apt-get install -y apt-transport-https
# install essential tools
sudo apt-get install -y \