Skip to content

Instantly share code, notes, and snippets.

@k2levin
Last active December 21, 2023 06:24
Show Gist options
  • Save k2levin/c2bc627ee98b2273f193675f6e28392c to your computer and use it in GitHub Desktop.
Save k2levin/c2bc627ee98b2273f193675f6e28392c to your computer and use it in GitHub Desktop.
knote
curl -X OPTIONS 'https://test.com/index.html' -H "Origin: https://www.google.com" -H "Access-Control-Request-Method: GET" -v
sudo chmod -R u=rwX,go=rX ./app
CREATE USER 'kevinkhew'@'%' IDENTIFIED BY 'KevinKhew';
GRANT ALL PRIVILEGES ON dbname.* TO 'kevinkhew'@'%';
FLUSH PRIVILEGES;
SHOW GLOBAL STATUS
WHERE Variable_name = 'Com_insert'
OR Variable_name = 'Com_select'
OR Variable_name = 'Com_Update'
OR Variable_name = 'Com_delete';
SELECT * FROM `recipes` WHERE JSON_EXTRACT(`filter_type`, '$[0]') = 99;
SELECT * FROM `api_logs` WHERE json_extract(response, '$.status') <> 200;
SHOW SESSION VARIABLES LIKE 'wait_timeout'; -- set to 3600
SHOW GLOBAL VARIABLES LIKE 'wait_timeout'; -- set to 3600
SHOW SESSION VARIABLES LIKE 'interactive_timeout'; -- set to 28800
SHOW GLOBAL VARIABLES LIKE 'interactive_timeout'; -- set to 28800
== install docker ==
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo groupadd docker
sudo usermod -aG docker $USER
==
sudo systemctl status
sudo systemctl list-units --failed
openssl rand -base64 12
s6-setuidgid www-data php /var/www/html/artisan queue:work
wrk -t2 -c50 -d60s https://test.com/status --header 'x-api-key: abc'
git clone --single-branch --branch <branch-name> <repo-address>
docker exec -i conainer_name sh -c 'exec mysqldump --single-transaction --skip-lock-tables -h db -u root -pSecret db_name' > ./db_name_2021-03-03.sql
docker exec -i conainer_name sh -c 'exec mysql -h db -u root -pSecret db_name' < ./db_name_2021-03-03.sql
# view all docker env secret
docker exec mycontainer /usr/bin/env
# cpu full load
sha1sum /dev/zero &
# 2022-10-18 15:27:38
echo `date +%Y-%m-%d\ %H:%M:%S`
# youtube-dl
docker run --rm -v $PWD:/data jauderho/yt-dlp -F https://youtu.be/27NfilLOvmI
140 m4a audio only 2 | 174.75MiB 129k https | audio only mp4a.40.2 129k 44k medium, m4a_dash
docker run --rm -v $PWD:/data jauderho/yt-dlp -f 140 https://youtu.be/27NfilLOvmI --paths /data -o romantic_guitar_music.m4a
SCRIPT_FILENAME=/var/www/html/public/index.php \
REQUEST_URI=/api/status \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect 10.42.0.43:9000
# The submit event will no longer reload the page
<form v-on:submit.prevent="onSubmit"></form>
# make log method
methods: {
log(message) {
console.log(message);
},
},
Center Div
==========
# for child div
.classic {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
---
# for parent div
.flex {
display: flex;
align-items: center;
justify-content: center;
}
---
# for parent div
.grid {
display: grid;
place-items: center;
}
sudo docker run -it --rm --name certbot \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
-p 80:80 \
certbot/certbot certonly
# ssh tunneling for local access to remote database
ssh [email protected] -NL 127.0.0.1:33069:172.16.2.111:3306 -f -o ServerAliveInterval=180
list all = wsl -l -v
shut one = wsl -t <DistroName>
shut all = wsl --shutdown
boot one = wsl -d <DistroName>
kubectl config view
KUBECONFIG=~/.kube/config:~/.kube/kubconfig2
kubectl config get-contexts
kubectl config use-context my-cluster-name
kubectl config set-context --current --namespace=ggckad-s2
kubectl get cronjob --all-namespaces
kubectl get job --all-namespaces
kubectl create cronjob hello --image=busybox --schedule="* * * * *" -- echo "Hello World"
kubectl create cronjob laravel --schedule="* * * * *" -- php /var/www/html/artisan schedule:run >> /dev/null 2>&1
kubectl exec -it $(kubectl get pods -o name | grep admin-portal) -- bash
kubectl exec $(kubectl get pods -o name | grep admin-portal) -- php /var/www/html/artisan schedule:run >> /dev/null 2>&1
kubectl exec econnote-5bf8d74f49-kqf26 -- php /var/www/html/artisan schedule:run
kubectl exec $(kubectl get pods -o name | grep admin-portal) -- php /var/www/html/artisan renew:token
Cassandra = multi master, consistent for write, better read throughput
MongoDB = high availability, single master, better read latency
RocksDB = single node, good for log
docker stack deploy -c t1.yml local
===================================
version: "3"
services:
app:
image: t1:v3
deploy:
mode: replicated
replicas: 2
ports:
- "80:80"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment