Skip to content

Instantly share code, notes, and snippets.

View Zheaoli's full-sized avatar
🇯🇵
Travel In Japan

Nadeshiko Manju Zheaoli

🇯🇵
Travel In Japan
View GitHub Profile
#include <algorithm>
#include <ctime>
#include <iostream>
int main()
{
const unsigned arraySize = 32768;
int data[arraySize];
for (unsigned c = 0; c < arraySize; ++c)
│Message from syslogd@developer at Jun 21 07:42:22 ...
│ kernel:[840130.553286] systemd[1]: segfault at 320 ip 0000000000000320 sp 00007ffcb223de80 error 14 in systemd[556c24c88000+32000]
│Message from syslogd@developer at Jun 21 07:42:22 ...
│ kernel:[840130.564182] Code: Unable to acce
#ifndef PTRACE_H
#define PTRACE_H
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ptrace.h>
#include <sys/reg.h>
#include <sys/uio.h>
@Zheaoli
Zheaoli / The new version v1.24.0 kubectl cli uses an invalid workaround on aws eks.md
Last active May 2, 2025 10:41
新版 v1.24.0 kubectl cli 在 aws eks 上使用失效的解决方法.md

Please update your awscli to 2.6.3

In v1.24.0, kubectl will report the following error when relying on the kubeconfig generated by aws-cli

> error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

The reason is that Kubernetes deprecated client.authentication.k8s.io/v1alpha1" from the exec plugin in PR108616

And the aws-cli update PR6476 has not been merged. There are two solutions

@Zheaoli
Zheaoli / client.py
Last active June 29, 2022 09:09
Connection in Use Case
import socket
import time
s = socket.socket()
host = "127.0.0.1"
port = 12345
s.connect((host, port))
print(s.recv(1024).decode())
time.sleep(10000000)
@Zheaoli
Zheaoli / Jetbrains JVM Config
Last active July 27, 2022 05:37
This is a JVM config for Jetbrains IDE on my laptop(With i9 10th CPU and 64G RAM)
-Xms128m
-Xmx8182m
-XX:ReservedCodeCacheSize=512m
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:+UnlockExperimentalVMOptions -XX:+UseZGC
-XX:ZCollectionInterval=120 -XX:ZAllocationSpikeTolerance=5
-XX:+UnlockDiagnosticVMOptions -XX:-ZProactive
%{
#include<linux/byteorder/generic.h>
#include<linux/if_ether.h>
#include<linux/skbuff.h>
#include<linux/ip.h>
#include<linux/in.h>
#include<linux/tcp.h>
#include <linux/sched.h>
#include <linux/list.h>
#include <linux/pid.h>
from bcc import BPF
import ctypes
bpf_text ="""
#include <linux/ptrace.h>
#include <linux/sched.h> /* For TASK_COMM_LEN */
#include <linux/icmp.h>
#include <linux/ip.h>
#include <linux/netdevice.h>
@Zheaoli
Zheaoli / demo4.py
Last active January 15, 2021 13:26
import os
import shutil
def copy_dirs(from_file, to_file):
temp_path = "/"
target = to_file.split("/")
target = target[:len(target) - 1]
while target:
temp_path = os.path.join(temp_path, target.pop(0))
import threading
from concurrent.futures import ThreadPoolExecutor
from typing import List
LOCK = threading.Lock()
def task(flag: int, queue: List[int], count: int, mod: int):
while True:
with LOCK: