BashTricks

programming

💼Looking for work💼 I'm currently open to new opportunities in hands-on architecture, management, and/or innovation work with LLMs. Please contact me on my LinkedIn if interested.

Run multiple commands in a single line

You can use the & operator to run multiple commands in a single line. For example:

command1 & command2 & command3

Run multiple servers in a single terminal

You can run multiple servers in a single terminal by combining the & operator with the wait command. For example:

node server1.js & node server2.js & wait

(This can sometimes be way better than using concurrently or npm-run-all, for example. Definitely removes the exposure to supply chain attacks.)

See recent git history

git reflog is a great way to see what branches were recently visited.

git log --oneline is a good way to just see recent commit messages and their hashes.

Initialize a project with Vite + React + Typescript + Tailwind + DaisyUI

# Name the project
project_name=someprojectname

# Initialize, install & initial commit
pnpm create vite --template=react-ts $project_name
cd $project_name
pnpm i && git init && git add . && git commit -m 'Initial Commit'

# Clean files
rm src/App.css src/App.tsx src/assets/react.svg
echo '' > src/index.css
echo -e 'export default function App(){\n    return (<h1>Hello World</h1>);\n}' > src/App.tsx

# Add daisyui and tailwind, and approve builds with pnpm
echo -e "onlyBuiltDependencies:\n  - '@tailwindcss/oxide'" > pnpm-workspace.yaml
pnpm install tailwindcss@latest @tailwindcss/vite@latest daisyui@latest
echo -e "import { defineConfig } from 'vite'\nimport tailwindcss from '@tailwindcss/vite'\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n  ],\n})" > vite.config.ts
echo -e '@import "tailwindcss";\n@plugin "daisyui";' > src/index.css

# Commit
git add .
git commit -m "Cleaned files and installed DaisyUI and Tailwind."

# Open VSCode
code . &