Skip to content

Instantly share code, notes, and snippets.

View kuenishi's full-sized avatar
🎴

UENISHI Kota kuenishi

🎴
View GitHub Profile
@kuenishi
kuenishi / cap.py
Last active July 18, 2023 06:17
capability demonstration
import os
import sys
pid = os.getpid()
with open(f"/proc/{pid}/status") as fp:
for line in fp.readlines():
if line.startswith("Cap"):
print(line.strip())
diff --git a/instrumentation/net/http/otelhttp/example/server/server.go b/instrumentation/net/http/otelhttp/example/server/server.go
index 7389c267..f128042b 100644
--- a/instrumentation/net/http/otelhttp/example/server/server.go
+++ b/instrumentation/net/http/otelhttp/example/server/server.go
@@ -19,6 +19,7 @@ import (
"io"
"log"
"net/http"
+ "sync"
import java.util.function.Function;
import java.lang.Long;
class Bench {
public static void main(String[] args) {
bench("noop ", (l) -> "");
bench("Long.toHexString()", (l) -> Long.toHexString(l));
bench("byteString.... ", (l) -> sfy(l));
bench("String.format(...)", (l) -> String.format("%016X", l));
class HelloWorld {
public static void main(String[] args) {
bench1();
bench2();
}
static void bench1() {
long repeat = 1000000000L;
long start = java.lang.System.currentTimeMillis();
for (long i = 0; i < repeat; i++) {

Ozone Code Review 2

HDDS-4819: OM HA configuration

Before, for service id sid, om1 config will be like:

ozone.om.address.sid.om1=0.0.0.0
ozone.om.address.sid.om2=om2
ozone.om.address.sid.om3=om3
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@kuenishi
kuenishi / zfsslower
Last active March 1, 2021 01:05
Modified zfsslower for rename, originally from https://github.com/iovisor/bcc
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# zfsslower Trace slow ZFS operations.
# For Linux, uses BCC, eBPF.
#
# USAGE: zfsslower [-h] [-j] [-p PID] [min_ms]
#
# This script traces common ZFS file operations: reads, writes, opens, and
# syncs. It measures the time spent in these operations, and prints details
import sys
def char(i):
'''
0-9A-Z => sp(decimal)
'''
if i >= 0 and i <= 9:
return chr(ord('0')+i)
elif i < 36:
return chr(ord('A')+i-10)