Skip to content

Instantly share code, notes, and snippets.

View addozhang's full-sized avatar
🦊
I may be slow to respond.

Addo.Zhang addozhang

🦊
I may be slow to respond.
View GitHub Profile
@addozhang
addozhang / cleanupk3s.sh
Created April 26, 2024 09:13
Setup K3s cluster via k3sup within one minute
#!/bin/bash
# Read the list of IP addresses from the environment variable
IP_ADDRESSES=($HOSTS)
# Check if there is at least one IP address
if [ ${#IP_ADDRESSES[@]} -eq 0 ]; then
echo "No IP addresses found. Please ensure the HOSTS environment variable is correctly set."
exit 1
fi
@addozhang
addozhang / activity.py
Created November 21, 2023 01:59
A python script for adding MVP blog activities from blog sitemap
from xml.etree import ElementTree as ET
import datetime
import requests
import time
# Load and parse the XML file
file_path = '[PATH]' # Replace [PATH] with the actual path
userProfileId = '[USER_PROFILE_ID]' # Replace [USER_PROFILE_ID] with the actual user profile ID
token = 'Bearer [TOKEN]' # Replace [TOKEN] with the actual token
lastRenewalDate = "2022-10-01"
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@addozhang
addozhang / K8s-CKA-CAKD-Bookmarks.html
Created June 30, 2021 08:31
Bookmarks for K8s CKA CKAD
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<DT><H3 ADD_DATE="1619442857" LAST_MODIFIED="1621171927">K8s-CKA-CAKD-Bookmarks</H3>
<DL><p>
<DT><A HREF="https://kubernetes.io/docs/reference/kubectl/cheatsheet/" ADD_DATE="1573290265" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADbElEQVQ4jW2TS2xUdRjFz/f/35k7z86LAcaWBlDSEtBWSgUbUiIYTRtQ6yNRHkZDJBFNBMSNBq0kuNCYaAl1IbJwYcBqFETFKgmMEbAxausQpdQOpsVhOoxt58773v/9XNQ2LPytvvMl56zOAf6DmeXcDRBPDT2WL1tfF8rWCc79/ABugpkF/g/uhsbTg49nctap9/sNs7N7krsOTvNH5/KVXNH8jHO/dTFAN3vmBOevbM1Yi3d8esG85+SAhd+Thr0oKm1lM1JZJZsbgvTgXcBDba5vAtbIB+Rv7JsLYC7v6/tRf+vtvkmkMkUV8hFfy1ryyXt9KFcZfd8XEQtLNVVgWnqLV+59JIjNd1aeJ+k6TPxVh/732s8vdHYXmxb4y1bFJG0qr2j7Ri/aV7qgFPDtryUcO1fEwqBkm9k0TI/zi/3us7Ee530amncvSSTNJUa+RE31mmNDkwsNdU4MDJfpH0OhXGXMDwi891yYR9MWnfml5Lg4XMLQqFwe23Y4JuC
@addozhang
addozhang / EurekaRequest.java
Last active August 8, 2019 07:38
Btrace script for reproducing eureka instance registering starting status
import com.sun.btrace.annotations.BTrace;
import com.sun.btrace.annotations.Kind;
import com.sun.btrace.annotations.Location;
import com.sun.btrace.annotations.OnMethod;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.sun.btrace.BTraceUtils.currentThread;
import static com.sun.btrace.BTraceUtils.println;
@addozhang
addozhang / Mac OS X 10_5_ Windows Ctrl.xml
Created July 4, 2018 02:36 — forked from fljot/Mac OS X 10_5_ Windows Ctrl.xml
AutoHotkey mappings to emulate OSX keyboard shortcuts on Windows
<!-- put this to IDEA keymaps config folder. For v13 it is <userdir>\.IntelliJIdea13\config\keymaps\ -->
<?xml version="1.0" encoding="UTF-8"?>
<keymap version="1" name="Mac OS X 10.5+ Windows Ctrl" parent="Mac OS X 10.5+">
<action id="$Copy">
<keyboard-shortcut first-keystroke="meta C" />
<keyboard-shortcut first-keystroke="meta INSERT" />
<keyboard-shortcut first-keystroke="control C" />
<keyboard-shortcut first-keystroke="control INSERT" />
</action>
<action id="$Cut">
@addozhang
addozhang / docker_zookeeper_kafka_compose.yml
Created July 8, 2017 00:24
Docker compose for zookeeper and kafka
version: '3'
services:
zookeeper:
image: wurstmeister/zookeeper
stdin_open: true
ports:
- 2181:2181
restart: unless-stopped
kafka:
image: wurstmeister/kafka
@addozhang
addozhang / GreenPlum JDBC and C3P0 Datasource
Last active April 13, 2017 00:33
GreenPlum JDBC and C3P0 Datasource
import com.mchange.v2.c3p0.DataSources;
import javax.sql.DataSource;
import java.sql.*;
import java.util.Properties;
/**
* Created by addo on 2017/4/10.
*/
public class JDBCTest {
private static String POSTGRESQL_URL = "jdbc:postgresql://192.168.56.101:5432/example";
private static String POSTGRESQL_USERNAME = "dbuser";