Skip to content

Instantly share code, notes, and snippets.

View tsunejui's full-sized avatar
👋
Your IT Solutions Partner

Rex Wu tsunejui

👋
Your IT Solutions Partner
View GitHub Profile
@tsunejui
tsunejui / README.md
Last active February 23, 2024 06:28

Test SMTP Server with curl

replace <smtp-server> with your host of SMTP server

replace <username> with your username

replace <password> with your password

curl \--ssl-reqd \--url 'smtp://<smtp-server>:2525' \
@tsunejui
tsunejui / README.md
Last active February 23, 2024 06:28

Create A Spring Boot Project With curl

curl https://start.spring.io/starter.tgz \
     -d type=maven-project -d language=java \
     -d platformVersion=3.1.5 -d packaging=jar \
     -d jvmVersion=21 -d groupId=com.rex \
     -d artifactId=observability \
     -d name=observability \
 -d description="Demo project for Spring Boot observability" \
@tsunejui
tsunejui / README.md
Created January 28, 2024 12:45 — forked from mosquito/README.md
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@tsunejui
tsunejui / README.md
Created January 27, 2024 16:24 — forked from Integralist/README.md
[golang custom http client] #go #golang #http #client #timeouts #dns #resolver

Go Network Timeouts

NOTE: Guide to net/http timeouts

Although not explicitly stated, DNS resolution appears to be taken into consideration as part of the overall http.Client.Timeout setting. If you need to set your own DNS timeout, then it seems https://github.com/miekg/dns is a popular solution.

Additionally, it's important to realise how golang resolves hostnames to IPs (i.e. DNS resolution):
https://golang.org/pkg/net/#hdr-Name_Resolution

When cross-compiling binaries you'll find that CGO is typically disabled in favour of the native Go resolver. You can enforce CGO or native like so:

@tsunejui
tsunejui / generate-ios.sh
Created December 4, 2023 02:25 — forked from monmonja/generate-ios.sh
generate ios from command line
# download this file to your project folder and excute
# chmod +x generate-ios.sh
# then run using
# ./generate-ios.sh
# flutter build defaults to --release
flutter build ios
# make folder, add .app then zip it and rename it to .ipa
mkdir -p Payload

Process Review Command

ps -o pid,pidns,netns,mntns,ipcns,utsns,userns,args -p <pid>: take a look the details of the process

ps -o thcount <pid>: To get the number of threads for a given pid:

Podman Process

Placeholder list:

@tsunejui
tsunejui / scaledown.sh
Created November 7, 2023 14:28 — forked from waynedovey/scaledown.sh
Scale Down OpenShift Monitoring
oc patch clusterversion/version --type='merge' -p "$(cat <<- EOF
spec:
overrides:
- group: apps/v1
kind: Deployment
name: cluster-monitoring-operator
namespace: openshift-monitoring
unmanaged: true
EOF
)"
#!/bin/sh
#===================================================================================
#
# FILE: dump.sh
# USAGE: dump.sh [-i interface] [tcpdump-parameters]
# DESCRIPTION: tcpdump on any interface and add the prefix [Interace:xy] in front of the dump data.
# OPTIONS: same as tcpdump
# REQUIREMENTS: tcpdump, sed, ifconfig, kill, awk, grep, posix regex matching
# BUGS: ---
# FIXED: - In 1.0 The parameter -w would not work without -i parameter as multiple tcpdumps are started.
@tsunejui
tsunejui / ip-details.sh
Last active November 18, 2023 15:54
Determine the logical type of a linux network device
# src: https://serverfault.com/a/928394
ip -details link show |awk '/^[0-9]+:/ { line=NR; printf "\n%s ",gensub("(@.*|:)$","",1,$2) } NR == line+2 { printf "%s",$1 } END { printf "\n" }'
# src: https://unix.stackexchange.com/q/272850
ip -details -j l | jq -r '.[]|"\(.ifname), \(.link_type), \(.linkinfo.info_data.type), \(.linkinfo.info_kind), \(.linkinfo.info_slave_kind)"' | column -t -s ','
or
ip -details -j link show | jq -r '.[] | "\(.ifname), \(.linkinfo | .info_kind)"' | column -s ',' -t