Skip to content

Instantly share code, notes, and snippets.

View strongant's full-sized avatar

strongant strongant

View GitHub Profile
@strongant
strongant / java-call-graph2.sh
Created February 28, 2024 15:23
java-call-graph2 invoke in mac
java -classpath "jar/run_javacg2.jar:./lib/*" com.adrninistrator.javacg.stat.JCallGraph /Users/bwh/personal/code/spring-boot-prometheus-demo/target/prometheus-0.0.1-SNAPSHOT.jar
@strongant
strongant / deleteKeycloakClients.sh
Last active December 25, 2023 12:35
batch remove clients by curl
#!/bin/bash
clients="xxx
xxx1"
realm='xxx'
token='xxxxx'
# 设置 IFS 为换行符
IFS=$'\n'
@strongant
strongant / k8s-get-pods.json
Created September 20, 2023 08:24
get k8s pods
curl -s $APISERVER/api/v1/namespaces/default/pods/ --header "Authorization: Bearer $TOKEN" --cacert /tmp/ca.crt | jq -rM '.items[].metadata.name'
@strongant
strongant / consul-register.sh
Created June 13, 2023 06:47
consul register service curl
curl -XPUT -d '{"ID":"app-bz-paas-mysql-demo-sit-1","Name":"app-bz-paas-mysql-demo-sit-test","Tags":["test"], "Address":"10.244.130.105","Port":12002,"Check":{"DeregisterCriticalServiceAfter": "10s","Name":"MySQL-demo-test Service Check","http":"http://10.244.130.105:12002/actuator/health","Interval":"5s", "Timeout": "5s"}}' http://consul-cluster-address/v1/agent/service/register?replace-existing-checks=true

The view ClusterRole doesn’t actually have permissions for the Cluster level objects like Nodes and Persistent Volume Claims. So we’ll have to create a new RBAC config.

First, we’ll create a new dashboard-viewonly ClusterRole:

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: dashboard-viewonly
@strongant
strongant / CloneLearningTest.java
Created June 12, 2023 14:55 — forked from rherrmann/CloneLearningTest.java
'Learning Tests' that uses the JGit API to clone existing repositories: http://www.codeaffine.com/2015/11/30/jgit-clone-repository/
package com.codeaffine.jgit.example;
import static java.util.Collections.singleton;
import static org.eclipse.jgit.api.ListBranchCommand.ListMode.ALL;
import static org.eclipse.jgit.transport.RemoteConfig.getAllRemoteConfigs;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.util.List;
@strongant
strongant / reset-git-commit-time.sh
Created June 7, 2023 16:15
reset-git-commit-time
git filter-branch --env-filter \
'if [ $GIT_COMMIT = 119f9ecf58069b265ab22f1f97d2b648faf932e0 ]
then
export GIT_AUTHOR_DATE="Fri Jan 2 21:38:53 2009 -0800"
export GIT_COMMITTER_DATE="Sat May 19 01:01:01 2007 -0700"
fi'
@strongant
strongant / reset-grafana.sh
Created June 1, 2023 03:59
mac reset grafana password
sqlite3 /usr/local/var/lib/grafana/grafana.db
update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';
.exit
@strongant
strongant / elasticsearch7.repo
Last active May 18, 2023 15:37
elasticsearch7 repo
cat > /etc/yum.repos.d/elasticsearch.repo <<EOF
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
#!/bin/bash
# 指定Prometheus的Remote Write API URL
url="http://prometheus-server:9090/api/v1/write"
# 指定并发请求数量
concurrent_requests=10
# 指定每个请求发送的指标数量
metrics_per_request=1000