Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
NOW=$(date +'%Y-%m-%d')
BACKUP_DIR="/path/to/backup"
MYSQL_USER="root"
# mysql
# https://mensfeld.pl/2013/04/backup-mysql-dump-all-your-mysql-databases-in-separate-files/
databases=`/usr/bin/mysql --user=$MYSQL_USER -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema|mysql|test|phpmyadmin|sys)"`
for db in $databases; do
https://stackoverflow.com/questions/804115/when-do-you-use-git-rebase-instead-of-git-merge
https://docs.gitlab.com/ee/topics/git/git_rebase.html
video:
https://www.youtube.com/watch?v=xN1-2p06Urc
https://www.youtube.com/watch?v=uj8hjLyEBmU
Cloudflare Image Optimization:
https://www.fonts.com/cdn-cgi/image/format=auto,width=250/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
Wordpress version check API:
https://api.wordpress.org/core/version-check/1.7/
https://www.magentaa11y.com/
https://userway.org/audit/ (JAWS + Chrome, NVDA + Firefox, VoiceOver + iOS)
@hgc81538
hgc81538 / README.md
Last active June 23, 2023 04:28
fortify issue
# 1 commit
cp --parents `git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $commit_id` ../output
# between commits
cp --parents `git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $commit_id_start $commit_id_end` ../output
# reference
https://stackoverflow.com/questions/4541300/export-only-modified-and-added-files-with-folder-structure-in-git
https://stackoverflow.com/questions/29300910/how-to-send-output-of-ls-l-to-cp-command-using-pipes
@hgc81538
hgc81538 / bash.sh
Created June 28, 2019 05:18
Bash batch processing
for file in *.png; do convert $file -rotate 90 rotated-$file; done
# ref: https://www.howtogeek.com/109369/how-to-quickly-resize-convert-modify-images-from-the-linux-terminal/
@hgc81538
hgc81538 / setup_pc_steps.txt
Created June 7, 2018 07:24
PC setup steps
- install windows
- show file extension
- install chrome, classic shell, office, dropbox, firefox, thunderbird, filezilla (no bundle), libreoffice, notepad++, 7-zip (assign all archive extensions)
- show delete confirmation of rubbish bin
- power to high, no sleep
- remove microsoft store, mail in quick launch
- show all icons in tray
- disable onedrive
- use traditional photo viewer
- add outlook shortcut in desktop
@hgc81538
hgc81538 / gist:d54e0938d4a6274e6fca39e5a79cda23
Last active January 4, 2018 04:51
Server log sample for exceptions

linux

shutdown

Jan  4 11:05:44 HIDDEN kernel: hv_utils: Shutdown request received - graceful shutdown initiated

windows

shutdown

@hgc81538
hgc81538 / gist:7e20c0badae7db7bae2696201216b7fa
Last active April 17, 2018 07:23
ubuntu 16.04 high concurrent connection
/etc/sysctl.conf
net.core.somaxconn = 8192
net.ipv4.tcp_max_syn_backlog = 8192
// mysql
Connection failed: SQLSTATE[HY000] [1040] Too many connections
Connection failed: SQLSTATE[HY000] [2002] Resource temporarily unavailable
fix:
/etc/systemd/system/mysql.service