find . -name "node_modules" -prune -exec rm -rf '{}' +
find /dir1 -mindepth 2 -type f -exec mv -t /dir1 -i '{}' +
git config --global user.name "Your Name"
git config --global user.email [email protected]
--global
sets this for the whole user.
git config --global core.editor "code --wait"
git config --global core.autocrlf false
git config --global push.autoSetupRemote true
git log --oneline -S "whatever you want to search" --source --all
Private key
openssl genpkey -algorithm ed25519 -out private.pem
Public key
openssl pkey -in private.pem -pubout -out public.pem
Import
openvpn3 config-import --config config.ovpn
Connect
openvpn3 session-start --config config.ovpn
Disconnect
openvpn3 session-manage --disconnect --config config.ovpn
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
Use sudo
to avoid any permission errors.
You may want to v
flag out if you can't determine the cause in case of an error.
tar -czvf whatever.tar.gz folder
Note: It's better to run your program on a non-privileged port and use a webserver like nginx if that's applicable.
setcap 'cap_net_bind_service=+ep' /path/to/program
git log $(git describe --tags --abbrev=0)..HEAD --oneline --merges --first-parent
find . -type f -name "*.log" -print0 | xargs -0 rm
nohup ts-node scripts/script.ts &> script.log &
Possible fix to the error FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
export NODE_OPTIONS="--max-old-space-size=8192"
# then run the script
Script to find all folders in ~/src
those are not pushed, not committed, or are not git repositories (ChatGPT) for backing up
#!/bin/bash
src_dir=~/src
# Define color codes
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
NC='\033[0m' # No color
for dir in "$src_dir"/*/; do
repo_dir="$dir"
if [ -d "$repo_dir/.git" ]; then
cd "$repo_dir"
if [ -z "$(git status --porcelain)" ]; then
echo -e "${GREEN}Repository at $repo_dir is clean.${NC}"
else
if [ -n "$(git ls-files --exclude-standard --others)" ]; then
echo -e "${RED}Repository at $repo_dir has untracked files.${NC}"
fi
if [ -n "$(git diff --stat)" ]; then
echo -e "${RED}Repository at $repo_dir has uncommitted changes.${NC}"
fi
if [ -n "$(git log --branches --not --remotes)" ]; then
echo -e "${RED}Repository at $repo_dir has unpushed commits.${NC}"
fi
fi
else
echo -e "${YELLOW}$repo_dir is a project directory without a Git repository.${NC}"
fi
done