From 843febb73da4377c9e436f4a79cb714e9f4cf119 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 04:11:28 +0000 Subject: [PATCH] Deploy to GitHub pages --- .nojekyll | 0 404.html | 1 + _next/data/bDDKiCGkIexFAZGQ7QWXD/index.json | 1 + .../lessons/intro/intro.json | 1 + .../lessons/navigation/tmux.json | 1 + .../lessons/navigation/window.json | 1 + .../lessons/outro/outro.json | 1 + .../lessons/terminal/intro.json | 1 + .../lessons/tools/intro.json | 1 + .../lessons/tools/jq.json | 1 + .../lessons/tools/neovim.json | 1 + .../lessons/tools/unix.json | 1 + .../lessons/your-env/ansible.json | 1 + .../lessons/your-env/neovim.json | 1 + .../lessons/your-env/roll-your-own.json | 1 + .../lessons/your-env/wait.json | 1 + .../lessons/your-env/your-env.json | 1 + .../bDDKiCGkIexFAZGQ7QWXD/_buildManifest.js | 1 + .../bDDKiCGkIexFAZGQ7QWXD/_ssgManifest.js | 1 + .../chunks/framework-ecc4130bc7a58a64.js | 33 + _next/static/chunks/main-27b76dd530f8f7ed.js | 1 + .../chunks/pages/_app-2c264ec931dc1798.js | 1 + .../chunks/pages/_error-77823ddac6993d35.js | 1 + .../chunks/pages/index-49a3879d914cc49e.js | 1 + .../[section]/[slug]-7e79801f4e913ad6.js | 1 + .../chunks/polyfills-78c92fac7aa8fdd8.js | 1 + .../static/chunks/webpack-8dbb88a6459cf950.js | 1 + _next/static/css/77aba6635732f01b.css | 13 + _next/static/media/fa-brands-400.13428122.ttf | Bin 0 -> 209376 bytes .../static/media/fa-brands-400.60e5c9d3.woff2 | Bin 0 -> 118072 bytes .../media/fa-regular-400.6f7d0aec.woff2 | Bin 0 -> 25464 bytes .../static/media/fa-regular-400.d151c40a.ttf | Bin 0 -> 67976 bytes _next/static/media/fa-solid-900.bd6c2137.ttf | Bin 0 -> 423676 bytes .../static/media/fa-solid-900.cece584e.woff2 | Bin 0 -> 157192 bytes .../media/fa-v4compatibility.9b501f80.ttf | Bin 0 -> 10836 bytes .../media/fa-v4compatibility.e43d1602.woff2 | Bin 0 -> 4800 bytes images/BRAND-WHearts.png | Bin 0 -> 229270 bytes images/apple-touch-icon.png | Bin 0 -> 8231 bytes images/author.jpg | Bin 0 -> 19134 bytes images/course-icon.png | Bin 0 -> 16634 bytes images/favicon-16x16.png | Bin 0 -> 655 bytes images/favicon-32x32.png | Bin 0 -> 1296 bytes images/favicon.ico | Bin 0 -> 15406 bytes images/social-share-cover.jpg | Bin 0 -> 77290 bytes index.html | 1 + lessons.csv | 15 + lessons/intro/intro.html | 128 ++++ lessons/navigation/tmux.html | 703 ++++++++++++++++++ lessons/navigation/window.html | 181 +++++ lessons/outro/outro.html | 44 ++ lessons/terminal/intro.html | 50 ++ lessons/tools/intro.html | 56 ++ lessons/tools/jq.html | 202 +++++ lessons/tools/neovim.html | 259 +++++++ lessons/tools/unix.html | 153 ++++ lessons/your-env/ansible.html | 525 +++++++++++++ lessons/your-env/neovim.html | 82 ++ lessons/your-env/roll-your-own.html | 514 +++++++++++++ lessons/your-env/wait.html | 257 +++++++ lessons/your-env/your-env.html | 53 ++ 60 files changed, 3294 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/index.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/intro/intro.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/navigation/tmux.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/navigation/window.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/outro/outro.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/terminal/intro.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/intro.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/jq.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/neovim.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/unix.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/ansible.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/neovim.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/roll-your-own.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/wait.json create mode 100644 _next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/your-env.json create mode 100644 _next/static/bDDKiCGkIexFAZGQ7QWXD/_buildManifest.js create mode 100644 _next/static/bDDKiCGkIexFAZGQ7QWXD/_ssgManifest.js create mode 100644 _next/static/chunks/framework-ecc4130bc7a58a64.js create mode 100644 _next/static/chunks/main-27b76dd530f8f7ed.js create mode 100644 _next/static/chunks/pages/_app-2c264ec931dc1798.js create mode 100644 _next/static/chunks/pages/_error-77823ddac6993d35.js create mode 100644 _next/static/chunks/pages/index-49a3879d914cc49e.js create mode 100644 _next/static/chunks/pages/lessons/[section]/[slug]-7e79801f4e913ad6.js create mode 100644 _next/static/chunks/polyfills-78c92fac7aa8fdd8.js create mode 100644 _next/static/chunks/webpack-8dbb88a6459cf950.js create mode 100644 _next/static/css/77aba6635732f01b.css create mode 100644 _next/static/media/fa-brands-400.13428122.ttf create mode 100644 _next/static/media/fa-brands-400.60e5c9d3.woff2 create mode 100644 _next/static/media/fa-regular-400.6f7d0aec.woff2 create mode 100644 _next/static/media/fa-regular-400.d151c40a.ttf create mode 100644 _next/static/media/fa-solid-900.bd6c2137.ttf create mode 100644 _next/static/media/fa-solid-900.cece584e.woff2 create mode 100644 _next/static/media/fa-v4compatibility.9b501f80.ttf create mode 100644 _next/static/media/fa-v4compatibility.e43d1602.woff2 create mode 100755 images/BRAND-WHearts.png create mode 100644 images/apple-touch-icon.png create mode 100644 images/author.jpg create mode 100644 images/course-icon.png create mode 100644 images/favicon-16x16.png create mode 100644 images/favicon-32x32.png create mode 100644 images/favicon.ico create mode 100644 images/social-share-cover.jpg create mode 100644 index.html create mode 100644 lessons.csv create mode 100644 lessons/intro/intro.html create mode 100644 lessons/navigation/tmux.html create mode 100644 lessons/navigation/window.html create mode 100644 lessons/outro/outro.html create mode 100644 lessons/terminal/intro.html create mode 100644 lessons/tools/intro.html create mode 100644 lessons/tools/jq.html create mode 100644 lessons/tools/neovim.html create mode 100644 lessons/tools/unix.html create mode 100644 lessons/your-env/ansible.html create mode 100644 lessons/your-env/neovim.html create mode 100644 lessons/your-env/roll-your-own.html create mode 100644 lessons/your-env/wait.html create mode 100644 lessons/your-env/your-env.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..0c05316 --- /dev/null +++ b/404.html @@ -0,0 +1 @@ +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/index.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/index.json new file mode 100644 index 0000000..286c519 --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/index.json @@ -0,0 +1 @@ +{"pageProps":{"sections":[{"icon":"info-circle","title":"Intro","slug":"intro","lessons":[{"slug":"intro","fullSlug":"/lessons/intro/intro","title":"Introduction to dev productivity","order":"01A","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/01-intro/A-intro.md","description":"there isn't a right way, but there is my way and its pretty good"}],"order":"01"},{"icon":"info-circle","title":"Your Env","slug":"your-env","lessons":[{"slug":"your-env","fullSlug":"/lessons/your-env/your-env","title":"Intro into your env","order":"02A","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/A-your-env.md","description":"lets take a tour"},{"slug":"ansible","fullSlug":"/lessons/your-env/ansible","title":"Ansible","order":"02B","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/B-ansible.md","description":"ansible"},{"slug":"roll-your-own","fullSlug":"/lessons/your-env/roll-your-own","title":"Reinvent the wheel","order":"02C","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/C-roll-your-own.md","description":"its one of the best past times"},{"slug":"neovim","fullSlug":"/lessons/your-env/neovim","title":"Put it all together","order":"02D","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/D-neovim.md","description":"Life is but a curl away..."},{"slug":"wait","fullSlug":"/lessons/your-env/wait","title":"Wait A Second","order":"02E","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/E-wait.md","description":"what about all the dot files?"}],"order":"02"},{"icon":"info-circle","title":"Navigation","slug":"navigation","lessons":[{"slug":"window","fullSlug":"/lessons/navigation/window","title":"Window Managers","order":"03A","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/03-navigation/A-window.md","description":"window managers"},{"slug":"tmux","fullSlug":"/lessons/navigation/tmux","title":"Tmux","order":"03B","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/03-navigation/B-tmux.md","description":"tmux is a great way to navigate around the terminal"}],"order":"03"},{"icon":"info-circle","title":"Tools","slug":"tools","lessons":[{"slug":"intro","fullSlug":"/lessons/tools/intro","title":"Intro","order":"04A","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/04-tools/A-intro.md","description":"The best of the best"},{"slug":"jq","fullSlug":"/lessons/tools/jq","title":"Tools","order":"04B","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/04-tools/B-jq.md","description":"jq a hidden treasure"},{"slug":"unix","fullSlug":"/lessons/tools/unix","title":"Unix Tools!","order":"04C","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/04-tools/C-unix.md","description":"unix tools"},{"slug":"neovim","fullSlug":"/lessons/tools/neovim","title":"Tools","order":"04D","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/04-tools/D-neovim.md","description":"your most used tool is the editor"}],"order":"04"},{"icon":"info-circle","title":"Terminal","slug":"terminal","lessons":[{"slug":"intro","fullSlug":"/lessons/terminal/intro","title":"Terminally Retired","order":"05A","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/05-terminal/A-intro.md","description":"this is my favorite place to be"}],"order":"05"},{"icon":"info-circle","title":"Outro","slug":"outro","lessons":[{"slug":"outro","fullSlug":"/lessons/outro/outro","title":"Outro","order":"06A","path":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/06-outro/A-outro.md","description":"goodbye"}],"order":"06"}]},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/intro/intro.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/intro/intro.json new file mode 100644 index 0000000..f8fa59e --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/intro/intro.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Introduction to dev productivity","description":"there isn't a right way, but there is my way and its pretty good"},"html":"

Dev Productivity

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

WHOAMI

\n

The name is ThePrimeagen

\n\n Twitch\n \n \n \n\n\n
\n\n\n ThePrimeTimeagen - Hand crafted meme's and toilet\n \n \n \n\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The Goal

\n

My approach to my environment.

\n

or as i like to say: there isn't a right way, but there is my way and its\npretty good. I only have one thing I optimize which is productivity.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Enqueue Midwit meme

\n
\n

BUT WHAT ABOUT i3-gaps, WHAT ABOUT ALL THE RICES

\n
\n

Honestly, I don't care. I just don't care at all. I just want to get where i\nwant to be in the fewest amount of keystrokes

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

A bit of prereq

\n

One thing that should be apparent is that i will be approaching this class from\na unix perspective.

\n

Its not that i don't think windows is good for dev, its just I never use it for\nanything but games.

\n

Enqueue I Don't even think of you meme

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## Dev Productivity\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## WHOAMI\nThe name is ThePrimeagen\n\n\n Twitch\n \n \n \n\n\n
\n\n\n ThePrimeTimeagen - Hand crafted meme's and toilet\n \n \n \n\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The Goal\nMy approach to _my environment_.\n\nor as i like to say: there isn't a right way, but there is my way and its\npretty good. I only have one thing I optimize which is productivity.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Enqueue Midwit meme\n> BUT WHAT ABOUT i3-gaps, WHAT ABOUT ALL THE RICES\n\nHonestly, I don't care. I just don't care at all. I just want to get where i\nwant to be in the fewest amount of keystrokes\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## A bit of prereq\nOne thing that should be apparent is that i will be approaching this class from\na unix perspective.\n\nIts not that i don't think windows is good for dev, its just I never use it for\nanything but games.\n\n### Enqueue I Don't even think of you meme\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"intro","title":"Introduction to dev productivity","section":"Intro","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/01-intro/A-intro.md","nextSlug":"/dev-prod-2/lessons/your-env/your-env","prevSlug":null}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/navigation/tmux.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/navigation/tmux.json new file mode 100644 index 0000000..c23ceae --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/navigation/tmux.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Tmux","description":"tmux is a great way to navigate around the terminal"},"html":"

The Terminal Experience

\n

I have a list of things i want in my terminal to make it useful and it all is

\n

centered around navigation.

\n

What I Want

\n
    \n
  1. sessions that last even when i close my terminal
  2. \n
  3. multiple running sessions, and these sessions are based on directory
  4. \n
  5. "tabs" within a session
  6. \n
  7. navigate to any session by directory name "instantly"
  8. \n
  9. navigate to any session by directory with fuzzy find
  10. \n
  11. run scripts or whatever programs i want when navigating to a directory
  12. \n
\n

** TO GIMP **

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

I Choose Tmux

\n

I personally use tmux + ghostty, though i hear wezterm, another terminal\nemulator, you can emulate pretty much every way I use tmux. I have not used\nwezterm so i cannot speak much about it. Zellij has similar experience but more\nmodern

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Quick Notes

\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Installing TMUX

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
PlatformInstall Command
Arch Linuxpacman -S tmux
Debian or Ubuntuapt install tmux
Fedoradnf install tmux
RHEL or CentOSyum install tmux
macOS (using Homebrew)brew install tmux
macOS (using MacPorts)port install tmux
openSUSEzypper install tmux
\n

Base Config

\n

Here is the basic config that will make life easier. This will ensure that you\nhave a similar experience to me

\n
set -g default-terminal "tmux-256color"\nset -s escape-time 0\nset -g base-index 1\n\n# optional -- i like C-a not C-b (pure preference)\nunbind C-b\nset-option -g prefix C-a\nbind-key C-a send-prefix\n\n# <WHERE YOUR TMUX CONF GOES> = XDG_CONFIG_HOME/tmux/tmux.conf\n# <WHERE YOUR TMUX CONF GOES> = ~/.tmux.conf\nbind r source-file <WHERE YOUR TMUX CONF GOES> \\; display-message "tmux.conf reloaded"\n

Install it via our dev-env!

\n

We can even use our fancy new dev-env script to install it!

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Lets navigate tmux

\n

Lets go through some basic commands about tmux so you can see how they work\nwith just usage. I will show you the ones I use and some that I don't use

\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

A bit of customization

\n

I like to navigate my tmux panes like i navigate my vim windows

\n

lets try this out:

\n
# Add to your tmux.conf file\nbind -r h select-pane -L\nbind -r j select-pane -D\nbind -r k select-pane -U\nbind -r l select-pane -R\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Based on my previous 5 points, only two have been met.

\n
\n
    \n
  1. sessions that last even when i close my terminal
  2. \n
  3. "tabs" within a session
  4. \n
\n
\n
\n
\n\n

It turns out that tmux is also scriptable! And its quite fantastic

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The Session API

\n

A target is a tuple of <session_name>[:<widx>|<wname>[.<pane_idx>]]

\n
tmux new-session -s <sname> -n <initial wname> -d[etach]\ntmux list-sessions\ntmux attach-session -t <target>\ntmux has-session -t <target> # don't forget -t vs -t=\ntmux switch-client -t <target>\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The Window API

\n
tmux new-window -n <name> [-t session:window_index]\ntmux list-windows [-t session]\ntmux select-window -t session:[window_idx | window_name].[pane_idx]\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Other fun apis

\n
tmux send-keys -t <target> "text" [ctrl keys,...]\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Lets start with our first script

\n

From my original points, we still have 4 points left to address to create the\n"perfect" navigation system for the terminal

\n

What I Want

\n
    \n
  1. DONE :: sessions that last even when i close my terminal
  2. \n
  3. multiple running sessions, and these sessions are based on directory
  4. \n
  5. DONE :: "tabs" within a session
  6. \n
  7. navigate to any session by directory name "instantly"
  8. \n
  9. navigate to any session by directory with fuzzy find
  10. \n
  11. run scripts or whatever programs i want when navigating to a directory
  12. \n
\n

Lets Address Point 6 First

\n

This is one of the easier points to address

\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Opener script

\n
#!/usr/bin/env bash\n\nif [[ -x ./.ready-tmux ]]; then\n    ./.ready-tmux\nelif [[ -x ~/.ready-tmux ]]; then\n    ~/.ready-tmux\nfi\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Thats pretty cool?

\n

That was pretty awesome that we can create all the windows / splits we want\nwith a simple script (don't worry, it'll get a lot better)

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Progress

\n

We have checked off another component of what I consider a great terminal\nexperience

\n
\n
    \n
  1. run scripts or whatever programs i want when navigating to a directory
  2. \n
\n
\n

But we still have a few left

\n
\n
    \n
  1. multiple running sessions, and these sessions are based on directory
  2. \n
  3. navigate to any session by directory name "instantly"
  4. \n
  5. navigate to any session by directory with fuzzy find
  6. \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Detour time

\n

FZF is an incredible tool for fuzzy finding. Its not just for finding\ndirectories. You can fuzzy find on anything you pass in and is often used\nwithin text editors.

\n

I will add fzf to my scripts

\n

dev-env/runs/libs

\n
# ... other libs i install ...\n\ngit clone git@github.com:junegunn/fzf.git $HOME/personal/fzf\n$HOME/personal/fzf/install\n

dev-env/env/.zsh_profile

\n
## All that sweet sweet fzf\n[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh\n

Execute

\n

Make sure i only run my libs script\nrun --dry libs

\n

Run my lib script\nrun libs

\n

Copy all of my files over\ndev-env

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Test run

\n

try pressing C-r (Control + r) and it should bring up a beautiful fuzzy find\ncomparatively to your standard C-r from the terminal

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Playing with FZF

\n

input

\n
➜  dev-prod-2 git:(main) ✗ echo "1\\n2\\n3" | fzf\n

output

\n
  3\n  2\n▌ 1\n  3/3 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n>\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Lets solve the last problems

\n
\n
    \n
  1. multiple running sessions, and these sessions are based on directory
  2. \n
  3. navigate to any session by directory name "instantly"
  4. \n
  5. navigate to any session by directory with fuzzy find
  6. \n
\n
\n

Some notes

\n\n

CODE TIME!!

\n

Lets start this MF script (MF = Mother FZF):

\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n
#!/usr/bin/env bash\n\nselected=$(find ~/personal -mindepth 1 -maxdepth 1 -type d | fzf)\necho "selected!! $selected"\n

Ok, lets do some great things

\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n
#!/usr/bin/env bash\n\nselected=$(find ~/personal ~/ ~/.config -maxdepth 1 -mindepth 1 -type d | fzf)\nif [[ -z "$selected" ]]; then\n    exit 0\nfi\nselected_name=$(basename "$selected" | tr ",.: " "____")\n\nif tmux has-session -t=$selected_name 2> /dev/null; then\n    tmux switch-client -t=$selected_name\n    exit 0\nfi\n\nif [[ -z "$TMUX" ]]; then\n    tmux new-session -s $selected_name -c $selected\n    exit 0\nfi\n\ntmux new-session -ds $selected_name -c $selected\ntmux switch-client -t $selected_name\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Combine our two scripts

\n

It would be nice if we could combine our two scripts...

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Next Expected Script

\n
#!/usr/bin/env bash\n\nselected=$(find ~/personal ~/ ~/.config -maxdepth 1 -mindepth 1 -type d | fzf)\nif [[ -z "$selected" ]]; then\n    exit 0\nfi\nselected_name=$(basename "$selected" | tr ",.: " "____")\n\nif tmux has-session -t=$selected_name 2> /dev/null; then\n    tmux switch-client -t=$selected_name\n    exit 0\nfi\n\nif [[ -z "$TMUX" ]]; then\n    tmux new-session -s $selected_name -c $selected\nelse\n    tmux new-session -ds $selected_name -c $selected\n    tmux switch-client -t $selected_name\nfi\ntmux send-keys -t $selected_name "ready-tmux"\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

How do i execute this?

\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## The Terminal Experience\nI have a list of things i want in my terminal to make it useful and it all is\n\ncentered around navigation.\n\n### What I Want\n1. sessions that last even when i close my terminal\n1. multiple running sessions, and these sessions are based on directory\n1. \"tabs\" within a session\n1. navigate to any session by directory name \"instantly\"\n1. navigate to any session by directory with fuzzy find\n1. run scripts or whatever programs i want when navigating to a directory\n\n** TO GIMP **\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## I Choose Tmux\nI personally use tmux + ghostty, though i hear wezterm, another terminal\nemulator, you can emulate pretty much every way I use tmux. I have not used\nwezterm so i cannot speak much about it. Zellij has similar experience but more\nmodern\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Quick Notes\n* About 3 years ago I did the first version of Dev productivity and some things\n about my setup has changed, and parts have remained the same. After 3 years,\n this is still my most useful script I have ever created. But i have added\n some significant improvements to the script\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Installing TMUX\n| Platform | Install Command |\n|-----------------------------|-------------------------|\n| Arch Linux | `pacman -S tmux` |\n| Debian or Ubuntu | `apt install tmux` |\n| Fedora | `dnf install tmux` |\n| RHEL or CentOS | `yum install tmux` |\n| macOS (using Homebrew) | `brew install tmux` |\n| macOS (using MacPorts) | `port install tmux` |\n| openSUSE | `zypper install tmux` |\n\n### Base Config\nHere is the basic config that will make life easier. This will ensure that you\nhave a similar experience to me\n\n```bash\nset -g default-terminal \"tmux-256color\"\nset -s escape-time 0\nset -g base-index 1\n\n# optional -- i like C-a not C-b (pure preference)\nunbind C-b\nset-option -g prefix C-a\nbind-key C-a send-prefix\n\n# = XDG_CONFIG_HOME/tmux/tmux.conf\n# = ~/.tmux.conf\nbind r source-file \\; display-message \"tmux.conf reloaded\"\n```\n\n### Install it via our dev-env!\nWe can even use our fancy new dev-env script to install it!\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Lets navigate tmux\nLets go through some basic commands about tmux so you can see how they work\nwith just usage. I will show you the ones I use and some that I don't use\n\n* what is prefix key\n* creating window\n* detaching\n* attaching\n* showing all running sessions\n* killing pane / window / session\n* creating and navigating splits\n * tmux is controlled by a config\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## A bit of customization\nI like to navigate my tmux panes like i navigate my vim windows\n\nlets try this out:\n\n```bash\n# Add to your tmux.conf file\nbind -r h select-pane -L\nbind -r j select-pane -D\nbind -r k select-pane -U\nbind -r l select-pane -R\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Based on my previous 5 points, only two have been met.\n> 1. sessions that last even when i close my terminal\n> 3. \"tabs\" within a session\n\n
\n
\n\nIt turns out that `tmux` is also scriptable! And its quite fantastic\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The Session API\n\nA `target` is a tuple of `[:|[.]]`\n\n```bash\ntmux new-session -s -n -d[etach]\ntmux list-sessions\ntmux attach-session -t \ntmux has-session -t # don't forget -t vs -t=\ntmux switch-client -t \n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The Window API\n\n```bash\ntmux new-window -n [-t session:window_index]\ntmux list-windows [-t session]\ntmux select-window -t session:[window_idx | window_name].[pane_idx]\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Other fun apis\n\n```bash\ntmux send-keys -t \"text\" [ctrl keys,...]\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Lets start with our first script\nFrom my original points, we still have 4 points left to address to create the\n\"perfect\" navigation system for the terminal\n\n### What I Want\n1. DONE :: sessions that last even when i close my terminal\n1. multiple running sessions, and these sessions are based on directory\n1. DONE :: \"tabs\" within a session\n1. navigate to any session by directory name \"instantly\"\n1. navigate to any session by directory with fuzzy find\n1. run scripts or whatever programs i want when navigating to a directory\n\n## Lets Address Point 6 First\nThis is one of the easier points to address\n\n* opens and creates the configuration you want for a project\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Opener script\n\n```bash\n#!/usr/bin/env bash\n\nif [[ -x ./.ready-tmux ]]; then\n ./.ready-tmux\nelif [[ -x ~/.ready-tmux ]]; then\n ~/.ready-tmux\nfi\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Thats pretty cool?\nThat was pretty awesome that we can create all the windows / splits we want\nwith a simple script (don't worry, it'll get a lot better)\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Progress\nWe have checked off another component of what I consider a great terminal\nexperience\n\n> 6. run scripts or whatever programs i want when navigating to a directory\n\nBut we still have a few left\n\n> 2. multiple running sessions, and these sessions are based on directory\n> 4. navigate to any session by directory name \"instantly\"\n> 5. navigate to any session by directory with fuzzy find\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Detour time\nFZF is an incredible tool for fuzzy finding. Its not just for finding\ndirectories. You can fuzzy find on anything you pass in and is often used\nwithin text editors.\n\n### I will add fzf to my scripts\n\n`dev-env/runs/libs`\n```bash\n# ... other libs i install ...\n\ngit clone git@github.com:junegunn/fzf.git $HOME/personal/fzf\n$HOME/personal/fzf/install\n```\n\n`dev-env/env/.zsh_profile`\n```bash\n## All that sweet sweet fzf\n[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh\n```\n\n### Execute\nMake sure i only run my libs script\n`run --dry libs`\n\nRun my lib script\n`run libs`\n\nCopy all of my files over\n`dev-env`\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Test run\ntry pressing `C-r` (Control + r) and it should bring up a beautiful fuzzy find\ncomparatively to your standard `C-r` from the terminal\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Playing with FZF\n\ninput\n```bash\n➜ dev-prod-2 git:(main) ✗ echo \"1\\n2\\n3\" | fzf\n```\n\noutput\n```bash\n 3\n 2\n▌ 1\n 3/3 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n>\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Lets solve the last problems\n> 2. multiple running sessions, and these sessions are based on directory\n> 4. navigate to any session by directory name \"instantly\"\n> 5. navigate to any session by directory with fuzzy find\n\n### Some notes\n* We don't want to search _every_ directory on the file system, we want to have\nsome sort of subset.\n\n* We want to navigate based on the results of FZF\n\n### CODE TIME!!\nLets start this MF script (MF = Mother FZF):\n* get a selected directory from fzf.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\n```bash\n#!/usr/bin/env bash\n\nselected=$(find ~/personal -mindepth 1 -maxdepth 1 -type d | fzf)\necho \"selected!! $selected\"\n```\n\n### Ok, lets do some great things\n* is there a running session given name\n * `:,.` are not allowed as session name\n * ` ` we should also remove spaces... but if you use a space in your directory name i dislike you\n * there are other non allowed characters, but we will not worry about them\n* if there is, navigate to that session\n* if there is not, create that session and navigate to it\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\n\n```bash\n#!/usr/bin/env bash\n\nselected=$(find ~/personal ~/ ~/.config -maxdepth 1 -mindepth 1 -type d | fzf)\nif [[ -z \"$selected\" ]]; then\n exit 0\nfi\nselected_name=$(basename \"$selected\" | tr \",.: \" \"____\")\n\nif tmux has-session -t=$selected_name 2> /dev/null; then\n tmux switch-client -t=$selected_name\n exit 0\nfi\n\nif [[ -z \"$TMUX\" ]]; then\n tmux new-session -s $selected_name -c $selected\n exit 0\nfi\n\ntmux new-session -ds $selected_name -c $selected\ntmux switch-client -t $selected_name\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Combine our two scripts\nIt would be nice if we could combine our two scripts...\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Next Expected Script\n```bash\n#!/usr/bin/env bash\n\nselected=$(find ~/personal ~/ ~/.config -maxdepth 1 -mindepth 1 -type d | fzf)\nif [[ -z \"$selected\" ]]; then\n exit 0\nfi\nselected_name=$(basename \"$selected\" | tr \",.: \" \"____\")\n\nif tmux has-session -t=$selected_name 2> /dev/null; then\n tmux switch-client -t=$selected_name\n exit 0\nfi\n\nif [[ -z \"$TMUX\" ]]; then\n tmux new-session -s $selected_name -c $selected\nelse\n tmux new-session -ds $selected_name -c $selected\n tmux switch-client -t $selected_name\nfi\ntmux send-keys -t $selected_name \"ready-tmux\"\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## How do i execute this?\n* we copy it to a $PATH location\n* we can create a tmux shortcut to execute it\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"tmux","title":"Tmux","section":"Navigation","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/03-navigation/B-tmux.md","nextSlug":"/dev-prod-2/lessons/tools/intro","prevSlug":"/dev-prod-2/lessons/navigation/window"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/navigation/window.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/navigation/window.json new file mode 100644 index 0000000..d385f2b --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/navigation/window.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Window Managers","description":"window managers"},"html":"

The most important aspect

\n

Is navigation.

\n
\n

You should never need your mouse or search with your eyes for your most common operations

\n
\n

This is how i think of my navigation:

\n
    \n
  1. 99.5% of things i do consistently, turn that into 1 to 2 buttons being\npressed
  2. \n
  3. 0.5% of things i do from time to time and i am ok using a mouse
  4. \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The window manager

\n

One of the most powerful things you can use is a window manager because it\ntakes care of one of the most annoying facets of computers. Placing windows

\n

If you are still placing windows manually, you are living in the stone age.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Window managers

\n

This will not be a large part of the course, but this will be the basis for how\nI approach everything from here on out.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

What is a window manager?

\n

This will really depend on the window manager you use.

\n
    \n
  • pop os
  • \n
  • i3
  • \n
  • awesomewm
  • \n
  • leftwm
  • \n
  • yabai (mac)
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The strategy I employ

\n

So there are many strategies you can employ, but here is the way I got about\nusing a window manager.

\n
    \n
  1. focus
  2. \n
  3. one key to where i need
  4. \n
\n
\n
\n\n

Let me get out ol gimp to show you what what i mean

\n
    \n
  • the complexity of mac desktops and navigation
  • \n
  • one one key matters
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Opening programs

\n

Another thing that windows and mac users have pretty much for free is a nice\nsearch bar for opening programs. Apple's Spotlight pretty much gets you what\nyou want asap.

\n

For linux, there is rofi, dmenu, and likely 100 more (its linux afterall)

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

I don't give any recs

\n

Notice that i am not giving any recommendations here. I just don't think it\nmatters. I don't see how you using AwsomeWM is going to make much of a\ndifference with my workflow as using i3.

\n

Now if i used more features, such as more than one window at a time in desktop\nI may need to explore more and come up with "better" solutions. But at this\npoint, for me it makes no difference.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## The most important aspect\nIs navigation.\n\n> You should never need your mouse or search with your eyes for your most common operations\n\nThis is how i think of my navigation:\n\n1. 99.5% of things i do consistently, turn that into 1 to 2 buttons being\n pressed\n1. 0.5% of things i do from time to time and i am ok using a mouse\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The window manager\nOne of the most powerful things you can use is a window manager because it\ntakes care of one of the most annoying facets of computers. Placing windows\n\n\nIf you are still placing windows manually, you are living in the stone age.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Window managers\nThis will not be a large part of the course, but this will be the basis for how\nI approach everything from here on out.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## What is a window manager?\nThis will really depend on the window manager you use.\n\n* pop os\n* i3\n* awesomewm\n* leftwm\n* yabai (mac)\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The strategy I employ\nSo there are many strategies you can employ, but here is the way I got about\nusing a window manager.\n\n1. focus\n2. one key to where i need\n\n
\n
\n\nLet me get out ol gimp to show you what what i mean\n* the complexity of mac desktops and navigation\n* one one key matters\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Opening programs\nAnother thing that windows and mac users have pretty much for free is a nice\nsearch bar for opening programs. Apple's Spotlight pretty much gets you what\nyou want asap.\n\nFor linux, there is `rofi`, `dmenu`, and likely 100 more (its linux afterall)\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## I don't give any recs\nNotice that i am not giving any recommendations here. I just don't think it\nmatters. I don't see how you using AwsomeWM is going to make much of a\ndifference with my workflow as using i3.\n\nNow if i used more features, such as more than one window at a time in desktop\nI may need to explore more and come up with \"better\" solutions. But at this\npoint, for me it makes no difference.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"window","title":"Window Managers","section":"Navigation","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/03-navigation/A-window.md","nextSlug":"/dev-prod-2/lessons/navigation/tmux","prevSlug":"/dev-prod-2/lessons/your-env/wait"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/outro/outro.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/outro/outro.json new file mode 100644 index 0000000..bd469ca --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/outro/outro.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Outro","description":"goodbye"},"html":"

And this is it

\n

Its the joy of making a better experience that helps keep me engaged as a dev.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Important note

\n

The most important thing about this course is not to do what I do, but to do\nwhat you want to do. Now I emphasized the most important tools you can get\nfamiliar with and their variations. Learn, enjoy, and figure out what you\nwant.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## And this is it\nIts the joy of making a better experience that helps keep me engaged as a dev.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Important note\nThe most important thing about this course is not to do what I do, but to do\nwhat _you_ want to do. Now I emphasized the most important tools you can get\nfamiliar with and their variations. Learn, enjoy, and figure out what you\nwant.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"outro","title":"Outro","section":"Outro","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/06-outro/A-outro.md","nextSlug":null,"prevSlug":"/dev-prod-2/lessons/terminal/intro"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/terminal/intro.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/terminal/intro.json new file mode 100644 index 0000000..0d2f526 --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/terminal/intro.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Terminally Retired","description":"this is my favorite place to be"},"html":"

This may get offensive

\n

I don't really care what terminal you use. I use Ghostty, its fast, and its\ncreated by someone I respect. That is it. Its really that simple.

\n
    \n
  • I get to chose my own colorscheme easily with ghostty
  • \n
  • I move on because all my customizations are at a different level
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Why Not?

\n

Alacritty - I was using it, now i am not\nKitty - Provides more terminal experiences closer to tmux, but the owner is exceptionally unpleasant, so i wont use it.\nGhostty - Provides everything Alactritty does but its by Mitchell!\nXterm-256color - I used this for so long. The only reason i upgraded to a gpu accellerated term was so i could run ascii doom in 30 fps at "high resolution."\nWezterm - I heard this one can make it so i don't have to use tmux anymore. Thats pretty neet. Maybe one day i'll give it a try

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## This may get offensive\nI don't really care what terminal you use. I use Ghostty, its fast, and its\ncreated by someone I respect. That is it. Its really that simple.\n\n* I get to chose my own colorscheme easily with ghostty\n* I move on because all my customizations are at a different level\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Why Not?\nAlacritty - I was using it, now i am not\nKitty - Provides more terminal experiences closer to tmux, but the owner is exceptionally unpleasant, so i wont use it.\nGhostty - Provides everything Alactritty does but its by Mitchell!\nXterm-256color - I used this for so long. The only reason i upgraded to a gpu accellerated term was so i could run ascii doom in 30 fps at \"high resolution.\"\nWezterm - I heard this one can make it so i don't have to use tmux anymore. Thats pretty neet. Maybe one day i'll give it a try\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"intro","title":"Terminally Retired","section":"Terminal","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/05-terminal/A-intro.md","nextSlug":"/dev-prod-2/lessons/outro/outro","prevSlug":"/dev-prod-2/lessons/tools/neovim"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/intro.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/intro.json new file mode 100644 index 0000000..4864dcf --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/intro.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Intro","description":"The best of the best"},"html":"

Supercharging your dev life

\n

One of the best ways to dramatically increase the speed of what you are doing\nis learning the posix ways and some of the tools out there to massively improve\nyour life

\n
\n
\n\n

I cannot tell you how many times in my earlier life i wrote a program that one\nsmall line of bash could have taken care of for me. Just knowing your tools is\na massive advantage in developer life.

\n
\n
\n\n

Another reality of dev'ing is that for a while a single tool will be so useful,\nthen you wont use it again for months. This has been my relationship with jq.\nIts ok, you will forget the practical part, but you wont forget what you can do\nas you learn these tools.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Note for FZF

\n

We already installed used it, so... its on the list of tools you should know

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## Supercharging your dev life\nOne of the best ways to dramatically increase the speed of what you are doing\nis learning the posix ways and some of the tools out there to massively improve\nyour life\n\n
\n
\n\nI cannot tell you how many times in my earlier life i wrote a program that one\nsmall line of bash could have taken care of for me. Just knowing your tools is\na massive advantage in developer life.\n\n
\n
\n\nAnother reality of dev'ing is that for a while a single tool will be so useful,\nthen you wont use it again for months. This has been my relationship with jq.\nIts ok, you will forget the practical part, but you wont forget what you can do\nas you learn these tools.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Note for FZF\nWe already installed used it, so... its on the list of tools you should know\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"intro","title":"Intro","section":"Tools","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/04-tools/A-intro.md","nextSlug":"/dev-prod-2/lessons/tools/jq","prevSlug":"/dev-prod-2/lessons/navigation/tmux"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/jq.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/jq.json new file mode 100644 index 0000000..965de6a --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/jq.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Tools","description":"jq a hidden treasure"},"html":"

JQ

\n

JQ, the hidden treasure in the family of CLI tools. This one has personaly\nsaved me so much time its hard to qualify just how important it is

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Lets create a file with the following content

\n
{"type": "foo", "values": [1, 2, 3, 4, 5]}\n{"type": "foo", "values": [69, 420, 42, 69420]}\n{"type": "bar", "values": {"a": 42, "b": 69}}\n{"type": "bar", "values": {"a": 1337, "b": 420}}\n{"type": "bar", "values": {"a": 111, "b": 222}}\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

prettify logs

\n
cat out | jq  # jq '' out\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

compact json

\n
cat out | jq | jq -c\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

check this out

\n
{\n  "type": "foo",\n  "values": [\n    1,\n    2,\n    3,\n    4,\n    5\n  ]\n}\n{\n  "type": "foo",\n  "values": [\n    69,\n    420,\n    42,\n    69420\n  ]\n}\n{\n  "type": "bar",\n  "values": {\n    "a": 42,\n    "b": 69\n  }\n}\n{\n  "type": "bar",\n  "values": {\n    "a": 1337,\n    "b": 420\n  }\n}\n{\n  "type": "bar",\n  "values": {\n    "a": 111,\n    "b": 222\n  }\n}\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

lets look at the data

\n

Lets sum ALL the foo's values arrays PER struct

\n
{"type": "foo", "values": [1, 2, 3, 4, 5]}\n{"type": "foo", "values": [69, 420, 42, 69420]}\n{"type": "bar", "values": {"a": 42, "b": 69}}\n{"type": "bar", "values": {"a": 1337, "b": 420}}\n{"type": "bar", "values": {"a": 111, "b": 222}}\n
➜  dev-prod-2 git:(main) ✗ cat out | jq 'select(.type == "foo") | .values | add'\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

lets do it again

\n

Lets sum ALL the foo's values arrays and add it as a key to type: foo valueSum

\n
{"type": "foo", "values": [1, 2, 3, 4, 5]}\n{"type": "foo", "values": [69, 420, 42, 69420]}\n{"type": "bar", "values": {"a": 42, "b": 69}}\n{"type": "bar", "values": {"a": 1337, "b": 420}}\n{"type": "bar", "values": {"a": 111, "b": 222}}\n
➜  dev-prod-2 git:(main) ✗ cat out | jq 'select(.type == "foo") | .valueSet = (.values | add)'\n

\n
\n\n

We can filter out the valueSet now

\n
➜  dev-prod-2 git:(main) ✗ cat out | jq 'select(.type == "foo") | .valueSet = (.values | add) | select(.valueSet > 20)'\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## JQ\nJQ, the hidden treasure in the family of CLI tools. This one has personaly\nsaved me so much time its hard to qualify just how important it is\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Lets create a file with the following content\n```json\n{\"type\": \"foo\", \"values\": [1, 2, 3, 4, 5]}\n{\"type\": \"foo\", \"values\": [69, 420, 42, 69420]}\n{\"type\": \"bar\", \"values\": {\"a\": 42, \"b\": 69}}\n{\"type\": \"bar\", \"values\": {\"a\": 1337, \"b\": 420}}\n{\"type\": \"bar\", \"values\": {\"a\": 111, \"b\": 222}}\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## prettify logs\n\n```bash\ncat out | jq # jq '' out\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## compact json\n\n```bash\ncat out | jq | jq -c\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## check this out\n\n```json\n{\n \"type\": \"foo\",\n \"values\": [\n 1,\n 2,\n 3,\n 4,\n 5\n ]\n}\n{\n \"type\": \"foo\",\n \"values\": [\n 69,\n 420,\n 42,\n 69420\n ]\n}\n{\n \"type\": \"bar\",\n \"values\": {\n \"a\": 42,\n \"b\": 69\n }\n}\n{\n \"type\": \"bar\",\n \"values\": {\n \"a\": 1337,\n \"b\": 420\n }\n}\n{\n \"type\": \"bar\",\n \"values\": {\n \"a\": 111,\n \"b\": 222\n }\n}\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## lets look at the data\nLets sum _ALL_ the foo's `values` arrays PER struct\n\n```json\n{\"type\": \"foo\", \"values\": [1, 2, 3, 4, 5]}\n{\"type\": \"foo\", \"values\": [69, 420, 42, 69420]}\n{\"type\": \"bar\", \"values\": {\"a\": 42, \"b\": 69}}\n{\"type\": \"bar\", \"values\": {\"a\": 1337, \"b\": 420}}\n{\"type\": \"bar\", \"values\": {\"a\": 111, \"b\": 222}}\n```\n\n```bash\n➜ dev-prod-2 git:(main) ✗ cat out | jq 'select(.type == \"foo\") | .values | add'\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## lets do it again\nLets sum _ALL_ the foo's `values` arrays and add it as a key to `type: foo` `valueSum`\n\n```json\n{\"type\": \"foo\", \"values\": [1, 2, 3, 4, 5]}\n{\"type\": \"foo\", \"values\": [69, 420, 42, 69420]}\n{\"type\": \"bar\", \"values\": {\"a\": 42, \"b\": 69}}\n{\"type\": \"bar\", \"values\": {\"a\": 1337, \"b\": 420}}\n{\"type\": \"bar\", \"values\": {\"a\": 111, \"b\": 222}}\n```\n\n```bash\n➜ dev-prod-2 git:(main) ✗ cat out | jq 'select(.type == \"foo\") | .valueSet = (.values | add)'\n```\n\n
\n
\n\n## We can filter out the `valueSet` now\n```bash\n➜ dev-prod-2 git:(main) ✗ cat out | jq 'select(.type == \"foo\") | .valueSet = (.values | add) | select(.valueSet > 20)'\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"jq","title":"Tools","section":"Tools","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/04-tools/B-jq.md","nextSlug":"/dev-prod-2/lessons/tools/unix","prevSlug":"/dev-prod-2/lessons/tools/intro"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/neovim.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/neovim.json new file mode 100644 index 0000000..e9af4a0 --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/neovim.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Tools","description":"your most used tool is the editor"},"html":"

Lets start with your editor

\n

Now i am going to show you around neovim, not because you are going to use\nneovim, but its good understand just how hackable it is and perhaps you will be\nwilling to try it

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Creating your own neovim experience

\n

I'll just give you a brief look at neovim and what you can do. This isn't\nreally a "follow" along section, but if you already have neovim setup, you\ncould.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

One more note about vim

\n

If you are getting a bit vim curious, seeing people fly around, its totally\nnormal. But i do want to warn you about 2 things.

\n
    \n
  1. you live in a world where you have really different mentality. This isn't\nthe era that vi or vim was created. So many modern luxuries that its hard\nto connect at first with Vim. So the best thing you can do at first is to\nlearn vim motions. Once you are sufficiently amazing at vim motions, then move\non to using vim. And of course, i recommend neovim

    \n
  2. \n
  3. When you first use vim, there is no filetree on the left, menu at the top,\njust text on the screen. This will make it hard to even read code because\nof how unfamiliar and hostile the environment seems. Don't worry, that\nfeeling will go away.

    \n
  4. \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Lets go over some of the motions

\n

Perhaps to give you a taste, lets go over some of the motions and why its\namazing.

\n

We can also go over some of the awesome remaps that i have dev'd / been given\nover the last few years.

\n
    \n
  • motions
  • \n
  • qfix
  • \n
  • harpoon
  • \n
  • navigation
  • \n
  • macros
  • \n
  • commands
  • \n
  • help
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

But why neovim?

\n

We get the best of both worlds, a modern IDE and vim motions. Why would I ever\nuse neovim?

\n
    \n
  • defense for neovim
  • \n
  • the bonus of using neovim that isn't quite the same with other editors
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Lets play with the neovim api

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n
local function read_file_with_system(filename)\n  local pipe = vim.system({"cat", filename})\n  local content = pipe:wait().stdout\n  local lines = vim.split(content, "\\n", { trimempty = true })\n  return lines\nend\n\nlocal api = vim.api\nlocal buf = api.nvim_create_buf(false, true)\nlocal win = api.nvim_open_win(buf, false, {\n    relative="editor",\n    width=80,\n    height=24,\n    row=0,\n    col=0,\n})\napi.nvim_buf_set_lines(buf, 0, -1, false, read_file_with_system("./package.json"))\n\nvim.defer_fn(function()\n    api.nvim_win_close(win, true)\nend, 5000)\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

There is so much more

\n

that was just a taste and there is so much more. I highly recommend playing\naround with the apis and making anything that you want.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

A quick note about AI

\n

One really nice thing about neovim is that the api is so well documented and\nthe surface area so well defined that you can often one shot exactly what you\nneed with neovim and chatgpt.

\n

this isn't always the case, it still makes up stuff ~5% of the time, but its\nclose.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

VimBeGood

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## Lets start with your editor\nNow i am going to show you around neovim, not because you are going to use\nneovim, but its good understand just how hackable it is and perhaps you will be\nwilling to try it\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Creating your own neovim experience\nI'll just give you a brief look at neovim and what you can do. This isn't\nreally a \"follow\" along section, but if you already have neovim setup, you\ncould.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## One more note about vim\nIf you are getting a bit vim curious, seeing people fly around, its totally\nnormal. But i do want to warn you about 2 things.\n\n1. you live in a world where you have really different mentality. This isn't\n the era that vi or vim was created. So many modern luxuries that its hard\n to connect at first with Vim. So the best thing you can do at first is to\n learn vim motions. Once you are sufficiently amazing at vim motions, then move\n on to using vim. And of course, i recommend neovim\n\n2. When you first use vim, there is no filetree on the left, menu at the top,\n just text on the screen. This will make it hard to even read code because\n of how unfamiliar and hostile the environment seems. Don't worry, that\n feeling will go away.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Lets go over some of the motions\nPerhaps to give you a taste, lets go over some of the motions and why its\namazing.\n\nWe can also go over some of the awesome remaps that i have dev'd / been given\nover the last few years.\n\n* motions\n* qfix\n* harpoon\n* navigation\n* macros\n* commands\n* help\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## But why neovim?\nWe get the best of both worlds, a modern IDE and vim motions. Why would I ever\nuse neovim?\n\n* defense for neovim\n* the bonus of using neovim that isn't quite the same with other editors\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Lets play with the neovim api\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\n```lua\nlocal function read_file_with_system(filename)\n local pipe = vim.system({\"cat\", filename})\n local content = pipe:wait().stdout\n local lines = vim.split(content, \"\\n\", { trimempty = true })\n return lines\nend\n\nlocal api = vim.api\nlocal buf = api.nvim_create_buf(false, true)\nlocal win = api.nvim_open_win(buf, false, {\n relative=\"editor\",\n width=80,\n height=24,\n row=0,\n col=0,\n})\napi.nvim_buf_set_lines(buf, 0, -1, false, read_file_with_system(\"./package.json\"))\n\nvim.defer_fn(function()\n api.nvim_win_close(win, true)\nend, 5000)\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## There is so much more\nthat was just a taste and there is so much more. I highly recommend playing\naround with the apis and making anything that you want.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## A quick note about AI\nOne really nice thing about neovim is that the api is so well documented and\nthe surface area so well defined that you can often one shot exactly what you\nneed with neovim and chatgpt.\n\nthis isn't always the case, it still makes up stuff ~5% of the time, but its\nclose.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## VimBeGood\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"neovim","title":"Tools","section":"Tools","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/04-tools/D-neovim.md","nextSlug":"/dev-prod-2/lessons/terminal/intro","prevSlug":"/dev-prod-2/lessons/tools/unix"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/unix.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/unix.json new file mode 100644 index 0000000..4aafe2a --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/tools/unix.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Unix Tools!","description":"unix tools"},"html":"

Unix Tools

\n

The unix set is super useful to know and we can do quite a bit of useful\ntransformation with them.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

lets transform out! (the json file)

\n

sed is a fun tool

\n
    \n
  • lets replace foo with bar
  • \n
  • lets replace foo or bar with foo,foo or bar,bar
  • \n
\n
➜  dev-prod-2 git:(main) cat out | sed 's/: "\\(.*\\)",/: "\\1,\\1",/'\n

Expected

\n
{"type": "foo,foo", "values": [1, 2, 3, 4, 5]}\n{"type": "foo,foo", "values": [69, 420, 42, 69420]}\n{"type": "bar,bar", "values": {"a": 42, "b": 69}}\n{"type": "bar,bar", "values": {"a": 1337, "b": 420}}\n{"type": "bar,bar", "values": {"a": 111, "b": 222}}\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

find

\n

list out files and do stuff

\n
➜  dev-prod-2 git:(main) ✗ find . -maxdepth 1 -mindepth 1 -type f -exec grep -Hn "foo" {} \\;\n./out:1:{"type": "foo", "values": [1, 2, 3, 4, 5]}\n./out:2:{"type": "foo", "values": [69, 420, 42, 69420]}\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

xargs

\n

a great tool

\n
➜  dev-prod-2 git:(main) ✗ echo "1\\n2\\n3" | xargs -I {} curl https://{}.com\ncurl: (6) Could not resolve host: 1.com\ncurl: (6) Could not resolve host: 2.com\ncurl: (6) Could not resolve host: 3.com\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

parallel

\n

such a great tool

\n

lets write a file with the entries of 1 through 9, per line

\n
1\n2\n3\n4\n5\n6\n7\n8\n9\n

now lets use parallel to control how fast it requests

\n
➜  dev-prod-2 git:(main) ✗ cat count | parallel -j 5 "curl https://{}.com"\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Just a touch of awk

\n

I don't know a lot of awk and you can do quite a bit, but the little i do know is really good

\n
➜  dev-prod-2 git:(main) ✗ ps aux | grep vim | awk '{ sum += $2 } END { print sum }'\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## Unix Tools\nThe unix set is super useful to know and we can do quite a bit of useful\ntransformation with them.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## lets transform out! (the json file)\n`sed` is a fun tool\n\n* lets replace `foo` with `bar`\n* lets replace `foo` or `bar` with `foo,foo` or `bar,bar`\n\n```bash\n➜ dev-prod-2 git:(main) cat out | sed 's/: \"\\(.*\\)\",/: \"\\1,\\1\",/'\n```\n\n### Expected\n```bash\n{\"type\": \"foo,foo\", \"values\": [1, 2, 3, 4, 5]}\n{\"type\": \"foo,foo\", \"values\": [69, 420, 42, 69420]}\n{\"type\": \"bar,bar\", \"values\": {\"a\": 42, \"b\": 69}}\n{\"type\": \"bar,bar\", \"values\": {\"a\": 1337, \"b\": 420}}\n{\"type\": \"bar,bar\", \"values\": {\"a\": 111, \"b\": 222}}\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## find\nlist out files and do stuff\n\n```bash\n➜ dev-prod-2 git:(main) ✗ find . -maxdepth 1 -mindepth 1 -type f -exec grep -Hn \"foo\" {} \\;\n./out:1:{\"type\": \"foo\", \"values\": [1, 2, 3, 4, 5]}\n./out:2:{\"type\": \"foo\", \"values\": [69, 420, 42, 69420]}\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## xargs\na great tool\n\n```bash\n➜ dev-prod-2 git:(main) ✗ echo \"1\\n2\\n3\" | xargs -I {} curl https://{}.com\ncurl: (6) Could not resolve host: 1.com\ncurl: (6) Could not resolve host: 2.com\ncurl: (6) Could not resolve host: 3.com\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## parallel\nsuch a great tool\n\nlets write a file with the entries of 1 through 9, per line\n```\n1\n2\n3\n4\n5\n6\n7\n8\n9\n```\n\nnow lets use parallel to control how fast it requests\n\n```bash\n➜ dev-prod-2 git:(main) ✗ cat count | parallel -j 5 \"curl https://{}.com\"\n```\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Just a touch of awk\nI don't know a lot of awk and you can do quite a bit, but the little i do know is really good\n\n```bash\n➜ dev-prod-2 git:(main) ✗ ps aux | grep vim | awk '{ sum += $2 } END { print sum }'\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"unix","title":"Unix Tools!","section":"Tools","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/04-tools/C-unix.md","nextSlug":"/dev-prod-2/lessons/tools/neovim","prevSlug":"/dev-prod-2/lessons/tools/jq"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/ansible.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/ansible.json new file mode 100644 index 0000000..4db1420 --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/ansible.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Ansible","description":"ansible"},"html":"

Ansible

\n

Now a long running way I have been using to manage my dotfiles have been\nexclusively through ansible. There are several pluses to managing through\nansible and there are some negatives

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Pros

\n
    \n
  • there is tons of online documentation
  • \n
  • its used more than just managing dotfiles
  • \n
  • ansible vault allows for plain storage of ssh keys! which is really cool
  • \n
  • you can also store a bunch of other cool stuff with ansible vault (think auth passcodes)
  • \n
\n

Cons

\n
    \n
  • it can be terribly slow
  • \n
  • it can be hard to make it work for certain tasks, such as installing neovim\nplugins
  • \n
  • tags can be great and super annoying
  • \n
  • yaml sucks
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Basic Ansible

\n

lets create a simple ansible script to clone neovim from source and build it\nfrom a specific tagged version

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

What is ansible?

\n

From their github

\n
\n

Ansible is a radically simple IT automation system. It handles configuration management, application deployment, cloud provisioning, ad-hoc task execution, network automation, and multi-node orchestration. Ansible makes complex changes like zero-downtime rolling updates with load balancers easy. More information on the Ansible website.

\n
\n

You are probably thinking... wait... aren't we talking about dotfiles and environments?

\n
\n
\n\n

Why yes we are!

\n
\n
\n\n

This is a tool designed for "servers" and if you squint your eyes you will\nrealize that you are just working on a "server."

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Install ansible

\n

as all adventures start...

\n
pip3 install ansible\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The heart of ansible

\n

Typically when you are working with ansible you are using an inventory, which\nis a list of all servers you have proper access to, and a series of playbooks.\nThe playbooks are where we specify the tasks we wish to perform on one or more\nnodes (machines). The playbook is the heart of ansible

\n
\n
\n\n

As a friend once said

\n
\n

ansible is the helicopter that drops godzilla

\n

... godzilla being k8s

\n
\n
\n
\n\n

Since we are operating on our own machine we wont need the inventory part, its\njust localhost

\n
\n
\n\n

Lets just jump right into the playbook side of ansible which is where all the\nwork is done

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Your First Playbook

\n

Lets start off by creating a playbook that will use git to download the\ncontents of neovim to a directory in a directory of our choosing

\n
    \n
  • create a new directory, lets call it mfansible
  • \n
  • create a file called neovim.yml
  • \n
  • input the following
  • \n
\n
- name: My first playbook\n  hosts: localhost\n  tasks:\n

with this alone we can now execute ansible and see the effects

\n
ansible-playbook neovim.yml\n

and you should see output that is similar to

\n
➜  ansible-neovim-example git:(master) ✗ ansible-playbook neovim.yml\n[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'\n\nPLAY [The Great Neovim editor] *****************************************************************************************************\n\nTASK [Gathering Facts] *************************************************************************************************************\nok: [localhost]\n\nPLAY RECAP *************************************************************************************************************************\nlocalhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Congrats!

\n

you have ran your first ansible script!

\n

Lets do some git

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Lets clone down neovim!

\n

When it comes to using ansible, one of my favorite features is the docs and how\nthey are organized. it just makes it so simple to google and get the exact\nanswer out you need. ChatGPT is nice to use, but can sometimes lead you into\ntoo much usage of odd features like scripting

\n
    \n
  • Google ansible git clone
  • \n
  • scroll the documentation and copy the one they suggest
  • \n
  • perhaps combine a few to make this most efficient!
  • \n
\n
\n
\n\n

But where do we put the code we find? Well... remember that empty tasks key?

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Task Output

\n
- name: My first playbook\n  hosts: localhost\n  tasks:\n  - name: Git neovim\n    ansible.builtin.git:\n      repo: "https://github.com/neovim/neovim.git"\n      dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim"\n      version: v0.10.2\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Become familiar with the build first

\n

there will be several libs that you may require to get this working so to do\nthis correctly you will first want to build neovim by hand and keep track of\nthe libraries that you need. There is likely a list of requirements in the\nBUILD.md

\n

Making neovim requires packages

\n

Here are the packages i needed to install from apt to get neovim

\n
sudo apt install cmake gettext lua5.1 liblua5.1-0-dev\n

Lets get the libraries first

\n

Lets translate what I installed into an ansible command.

\n
    \n
  • google how to ansible apt
  • \n
  • copy the proper command
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n

Your code should look something like this

\n
- name: My first playbook\n  hosts: localhost\n  tasks:\n  - name: Git neovim\n    ansible.builtin.git:\n      repo: "https://github.com/neovim/neovim.git"\n      dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim"\n      version: v0.10.2\n\n  - name: Install helping libs\n    become: true\n    ansible.builtin.apt:\n      pkg:\n      - lua5.1\n      - liblua5.1-0-dev\n      - cmake\n      - gettext\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

OH NO! Crash!

\n

If you are using apt and have to use sudo you should see the following error.

\n
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: theprimeagen\n<127.0.0.1> EXEC /bin/sh -c 'echo ~theprimeagen && sleep 0'\n<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/theprimeagen/.ansible/tmp `"&& mkdir "` echo /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333 `" && echo ansible-tmp-1729644436.258113-1776352-80352927742333="` echo /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333 `" ) && sleep 0'\nUsing module file /usr/lib/python3/dist-packages/ansible/modules/apt.py\n<127.0.0.1> PUT /home/theprimeagen/.ansible/tmp/ansible-local-1776140pp0cn_gm/tmp33hhis1k TO /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/AnsiballZ_apt.py\n<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/ /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/AnsiballZ_apt.py && sleep 0'\n<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n  -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-rgqphadrxzwvmzhucbtnjvxefbemoqpt ; /usr/bin/python3 /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/AnsiballZ_apt.py'"'"' && sleep 0'\n<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/ > /dev/null 2>&1 && sleep 0'\nfatal: [localhost]: FAILED! => {\n    "changed": false,\n    "module_stderr": "sudo: a password is required\\n",\n    "module_stdout": "",\n    "msg": "MODULE FAILURE\\nSee stdout/stderr for the exact error",\n    "rc": 1\n}\n

Well ansible does have the ability to become the sudo but it needs the creds to\ndo it, you can type in those creds before installing by using the -K flag

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Now build!

\n

Now all we have to build neovim and then sudo make install! We do the same\nprocess

\n
    \n
  • google make
  • \n
  • copy the relevant instructions
  • \n
  • implement the new tasks
  • \n
  • ...
  • \n
  • neovim (which is profit)!
  • \n
\n

To make neovim (from BUILD.md)

\n

The command to run to make neovim is the following:

\n
cd neovim && make CMAKE_BUILD_TYPE=RelWithDebInfo\n

then to install it we need to execute

\n
sudo make install\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected output

\n
- name: My first playbook\n  hosts: localhost\n  tasks:\n  - name: Git neovim\n    ansible.builtin.git:\n      repo: "https://github.com/neovim/neovim.git"\n      dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim"\n      version: v0.9.4\n\n  - name: Install helping libs\n    become: true\n    ansible.builtin.apt:\n      pkg:\n      - lua5.1\n      - liblua5.1-0-dev\n      - cmake\n      - gettext\n\n  - name: neovim\n    make:\n      chdir: "{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim"\n      params:\n        CMAKE_BUILD_TYPE: "RelWithDebInfo"\n\n  - name: neovim install\n    become: true\n    make:\n      target: install\n      chdir: "{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim"\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

And that is ansible

\n

that is what it takes to create neovim ansible.

\n
\n
\n\n

Why would i use this over a bash script

\n

A bash script is great when you can execute it on a machine, but ansible allows\nyou to execute all these operations on a bunch of host machines at once, your\nmachine, uniform syntax (yml). It also allows for some custom logic based on\noperating system so you could interchange out the fetching mechanism to make it\nmachine independent

\n
\n
\n\n

Ansible can be real great. It "seems" easier to maintain than having a bunch\nof bash scripts for each operating system. It can also make automating your\nsetup a bit easier.

\n
\n
\n\n

But for me... its a no at this point. I prefer a single script that i control

\n
    \n
  • some basic convention. Convention over configuration is a mantra i support
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## Ansible\nNow a long running way I have been using to manage my dotfiles have been\nexclusively through ansible. There are several pluses to managing through\nansible and there are some negatives\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Pros\n* there is tons of online documentation\n* its used more than just managing dotfiles\n* ansible vault allows for plain storage of ssh keys! which is really cool\n* you can also store a bunch of other cool stuff with ansible vault (think auth passcodes)\n\n## Cons\n* it can be terribly slow\n* it can be hard to make it work for certain tasks, such as installing neovim\n plugins\n* tags can be great and super annoying\n* yaml sucks\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Basic Ansible\nlets create a simple ansible script to clone neovim from source and build it\nfrom a specific tagged version\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## What is ansible?\nFrom their github
\n> Ansible is a radically simple IT automation system. It handles configuration management, application deployment, cloud provisioning, ad-hoc task execution, network automation, and multi-node orchestration. Ansible makes complex changes like zero-downtime rolling updates with load balancers easy. More information on the Ansible website.\n\nYou are probably thinking... wait... aren't we talking about dotfiles and environments?\n\n
\n
\n\nWhy yes we are!\n\n
\n
\n\nThis is a tool designed for \"servers\" and if you squint your eyes you will\nrealize that you are just working on a \"server.\"\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Install ansible\nas all adventures start...\n\n```\npip3 install ansible\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The heart of ansible\nTypically when you are working with ansible you are using an inventory, which\nis a list of all servers you have proper access to, and a series of playbooks.\nThe playbooks are where we specify the tasks we wish to perform on one or more\nnodes (machines). The playbook is the heart of ansible\n\n
\n
\n\nAs a friend once said\n> ansible is the helicopter that drops godzilla\n>\n>\n>\n>\n>\n>\n>\n>\n>\n>\n>\n> ... godzilla being k8s\n\n
\n
\n\nSince we are operating on our own machine we wont need the inventory part, its\njust `localhost`\n\n
\n
\n\nLets just jump right into the playbook side of ansible which is where all the\nwork is done\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Your First Playbook\nLets start off by creating a playbook that will use git to download the\ncontents of neovim to a directory in a directory of our choosing\n\n* create a new directory, lets call it `mfansible`\n* create a file called `neovim.yml`\n* input the following\n\n```yml\n- name: My first playbook\n hosts: localhost\n tasks:\n```\n\nwith this alone we can now execute ansible and see the effects\n\n```\nansible-playbook neovim.yml\n```\n\nand you should see output that is similar to\n\n```\n➜ ansible-neovim-example git:(master) ✗ ansible-playbook neovim.yml\n[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'\n\nPLAY [The Great Neovim editor] *****************************************************************************************************\n\nTASK [Gathering Facts] *************************************************************************************************************\nok: [localhost]\n\nPLAY RECAP *************************************************************************************************************************\nlocalhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Congrats!\nyou have ran your first ansible script!\n\nLets do some git\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Lets clone down neovim!\nWhen it comes to using ansible, one of my favorite features is the docs and how\nthey are organized. it just makes it so simple to google and get the exact\nanswer out you need. ChatGPT is nice to use, but can sometimes lead you into\ntoo much usage of odd features like scripting\n\n* Google ansible git clone\n* scroll the documentation and copy the one they suggest\n* perhaps combine a few to make this most efficient!\n\n
\n
\n\nBut where do we put the code we find? Well... remember that empty `tasks` key?\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Task Output\n\n\n```yaml\n- name: My first playbook\n hosts: localhost\n tasks:\n - name: Git neovim\n ansible.builtin.git:\n repo: \"https://github.com/neovim/neovim.git\"\n dest: \"{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim\"\n version: v0.10.2\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Become familiar with the build first\nthere will be several libs that you may require to get this working so to do\nthis correctly you will first want to build neovim by hand and keep track of\nthe libraries that you need. There is likely a list of requirements in the\n[BUILD.md](https://github.com/neovim/neovim/blob/master/BUILD.md)\n\n### Making neovim requires packages\nHere are the packages i needed to install from apt to get neovim\n\n```bash\nsudo apt install cmake gettext lua5.1 liblua5.1-0-dev\n```\n\n### Lets get the libraries first\nLets translate what I installed into an ansible command.\n\n* google how to ansible apt\n* copy the proper command\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\nYour code should look something like this\n\n```yaml\n- name: My first playbook\n hosts: localhost\n tasks:\n - name: Git neovim\n ansible.builtin.git:\n repo: \"https://github.com/neovim/neovim.git\"\n dest: \"{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim\"\n version: v0.10.2\n\n - name: Install helping libs\n become: true\n ansible.builtin.apt:\n pkg:\n - lua5.1\n - liblua5.1-0-dev\n - cmake\n - gettext\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## OH NO! Crash!\nIf you are using apt and have to use sudo you should see the following error.\n\n```\n<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: theprimeagen\n<127.0.0.1> EXEC /bin/sh -c 'echo ~theprimeagen && sleep 0'\n<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p \"` echo /home/theprimeagen/.ansible/tmp `\"&& mkdir \"` echo /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333 `\" && echo ansible-tmp-1729644436.258113-1776352-80352927742333=\"` echo /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333 `\" ) && sleep 0'\nUsing module file /usr/lib/python3/dist-packages/ansible/modules/apt.py\n<127.0.0.1> PUT /home/theprimeagen/.ansible/tmp/ansible-local-1776140pp0cn_gm/tmp33hhis1k TO /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/AnsiballZ_apt.py\n<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/ /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/AnsiballZ_apt.py && sleep 0'\n<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '\"'\"'echo BECOME-SUCCESS-rgqphadrxzwvmzhucbtnjvxefbemoqpt ; /usr/bin/python3 /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/AnsiballZ_apt.py'\"'\"' && sleep 0'\n<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/theprimeagen/.ansible/tmp/ansible-tmp-1729644436.258113-1776352-80352927742333/ > /dev/null 2>&1 && sleep 0'\nfatal: [localhost]: FAILED! => {\n \"changed\": false,\n \"module_stderr\": \"sudo: a password is required\\n\",\n \"module_stdout\": \"\",\n \"msg\": \"MODULE FAILURE\\nSee stdout/stderr for the exact error\",\n \"rc\": 1\n}\n```\n\nWell ansible does have the ability to become the sudo but it needs the creds to\ndo it, you can type in those creds before installing by using the -K flag\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Now build!\nNow all we have to build neovim and then sudo make install! We do the same\nprocess\n\n* google make\n* copy the relevant instructions\n* implement the new tasks\n* ...\n* neovim (which is profit)!\n\n### To make neovim (from BUILD.md)\nThe command to run to make neovim is the following:\n\n```bash\ncd neovim && make CMAKE_BUILD_TYPE=RelWithDebInfo\n```\n\nthen to install it we need to execute\n\n```bash\nsudo make install\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected output\n```yaml\n- name: My first playbook\n hosts: localhost\n tasks:\n - name: Git neovim\n ansible.builtin.git:\n repo: \"https://github.com/neovim/neovim.git\"\n dest: \"{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim\"\n version: v0.9.4\n\n - name: Install helping libs\n become: true\n ansible.builtin.apt:\n pkg:\n - lua5.1\n - liblua5.1-0-dev\n - cmake\n - gettext\n\n - name: neovim\n make:\n chdir: \"{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim\"\n params:\n CMAKE_BUILD_TYPE: \"RelWithDebInfo\"\n\n - name: neovim install\n become: true\n make:\n target: install\n chdir: \"{{ lookup('ansible.builtin.env', 'HOME') }}/personal/neovim\"\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## And that is ansible\nthat is what it takes to create neovim ansible.\n\n
\n
\n\n### Why would i use this over a bash script\nA bash script is great when you can execute it on a machine, but ansible allows\nyou to execute all these operations on a bunch of host machines at once, your\nmachine, uniform syntax (yml). It also allows for some custom logic based on\noperating system so you could interchange out the fetching mechanism to make it\nmachine independent\n\n
\n
\n\nAnsible can be real great. It \"seems\" easier to maintain than having a bunch\nof bash scripts for each operating system. It can also make automating your\nsetup a bit easier.\n\n
\n
\n\nBut for me... its a no at this point. I prefer a single script that i control\n+ some basic convention. Convention over configuration is a mantra i support\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"ansible","title":"Ansible","section":"Your Env","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/B-ansible.md","nextSlug":"/dev-prod-2/lessons/your-env/roll-your-own","prevSlug":"/dev-prod-2/lessons/your-env/your-env"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/neovim.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/neovim.json new file mode 100644 index 0000000..e5c0703 --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/neovim.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Put it all together","description":"Life is but a curl away..."},"html":"

Lets install neovim

\n

With ansible we:

\n
    \n
  • downloaded the neovim source
  • \n
  • built from neovim source
  • \n
  • installed neovim
  • \n
\n
\n
\n\n

Lets build the same thing, but in the bash script now!

\n

gituah: git@github.com:neovim/neovim.git
\ndeps: cmake gettext lua5.1 liblua5.1-0-dev

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Executable Code

\n
#!/usr/bin/env bash\n\ngit clone git@github.com:neovim/neovim.git ~/personal/neovim\ncd ~/personal/neovim\ngit fetch\ngit checkout v0.9.2\n\nsudo apt install cmake gettext lua5.1 liblua5.1-0-dev\nmake CMAKE_BUILD_TYPE=RelWithDebInfo\nsudo make install\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

And this is why I like bash

\n

Ansible is great and i used it for years, but in the end i am just going to use\nbash. I find it easier to maintain and i just find it more enjoyable

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## Lets install neovim\nWith ansible we:\n* downloaded the neovim source\n* built from neovim source\n* installed neovim\n\n
\n
\n\nLets build the same thing, but in the bash script now!\n\ngituah: git@github.com:neovim/neovim.git
\ndeps: cmake gettext lua5.1 liblua5.1-0-dev\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Executable Code\n```bash\n#!/usr/bin/env bash\n\ngit clone git@github.com:neovim/neovim.git ~/personal/neovim\ncd ~/personal/neovim\ngit fetch\ngit checkout v0.9.2\n\nsudo apt install cmake gettext lua5.1 liblua5.1-0-dev\nmake CMAKE_BUILD_TYPE=RelWithDebInfo\nsudo make install\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## And this is why I like bash\nAnsible is great and i used it for years, but in the end i am just going to use\nbash. I find it easier to maintain and i just find it more enjoyable\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"neovim","title":"Put it all together","section":"Your Env","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/D-neovim.md","nextSlug":"/dev-prod-2/lessons/your-env/wait","prevSlug":"/dev-prod-2/lessons/your-env/roll-your-own"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/roll-your-own.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/roll-your-own.json new file mode 100644 index 0000000..285ff7d --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/roll-your-own.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Reinvent the wheel","description":"its one of the best past times"},"html":"

Reinvent the wheel

\n

I love reinventing the wheel. There are many reasons why i like doing it too!

\n
\n
\n\n

You will gain

\n
    \n
  • a new appreciation of what it takes to create software
  • \n
  • learn a bunch about the topic along the way
  • \n
  • become a better engineer yourself, meaning you will now be able to guage\nproblems more accurately
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

My Current Bash Setup

\n

This is obviously subject to change. About once a year to every two years I\ntry to rethink through everything I have done and see if its something i like\nor hate. That way I can continue to improve my system but I don't end up\nbecoming a meme of the continually pursuit of perfection.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Lets set some goals

\n
    \n
  • I want to be able to bootstrap any machine i will purchase in the future that\nis ubuntu based.
      \n
    • i am not going to be clever and try to do a multiOS style, though this\nisn't hard its just tedious
    • \n
    • if i need a mac install script i am sure i can create a mac version
    • \n
    \n
  • \n
  • I want to be able to install all my favorite libraries
  • \n
  • I want the repos that i actively maintained brought down
  • \n
  • I want to be able to build neovim from source
  • \n
  • I want all the tools i use available
  • \n
  • I want to copy all my dotfiles over to my env. i like them separated.
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

I just want it all

\n

I really just want to automate my system with the greatest automation language\nof all time...

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

bash

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Rolling out own

\n

There are other versions of this exact same project that is someone elses\nversion. I want to emphasize that I think the more you own of your system the\nbetter it will be because its exactly the way you want it. You have the power\nto fashion it the way you want!

\n
\n
\n\n

But i am not foolish, this is also a double edge sword where you have to\nmaintain and improve your own system to make continue to make it great.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The idea

\n

Create a script called run that will, based on some arguments passed in,\nwill run 0 or more scripts. I want to make sure that scripts are easily\norganized so the scripts will be located in a subdirectory called runs

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

My version

\n

If you want to check out my final version of this product, check out my repo\nnamed dev

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Argument parsing and script setup

\n

Now we need to write the ackshual run script. Lets start with first creating\nthe dev environment. Meaning getting the libraries, projects, editor, etc etc\nthat we want on our machine.

\n

Perhaps a bit of white boarding could be useful here...

\n
    \n
  • create a project directory anywhere you deem fit
  • \n
  • create a script called run within the directory you just created and make it executable (chmod +x run) within
  • \n
  • open up your favorite text editor neovim (maybe something else...)
  • \n
\n
\n
\n\n

Start simple

\n
    \n
  • code up something that allows us to know the current directory and take in 1\nargument for filtering of tasks
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n
#!/usr/bin/env bash\n\nscript_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"\necho "$script_dir"\n\nfilter="$1"\n\necho "Run: dir $script_dir -- filter \\"$filter\\""\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

But how do we run scripts?

\n
    \n
  • we need to use our current script location to figure out all the available\nscripts and run them one by one and if we have a mask/filter/grep then use\nthat to prevent any extra execution

    \n
  • \n
  • coding time...

    \n
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n
# ... previous section ...\nscript_dir="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"\nfilter="$1"\n\ncd $script_dir\nscripts=$(find runs -maxdepth 1 -mindepth 1 -executable -type f)\n\nfor script in $scripts; do\n    if echo "$script" | grep -qv "$filter"; then\n        echo "filtered: $filter -- $script"\n        continue\n    fi\n    ./$script\ndone\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Quick Note

\n

why single bracket comparison ?

\n
if [ ! -z "$myvar" ]; then ...\n

why double bracket comparison ?

\n
if [[ $myvar == "" ]]; then ...\n

why no bracket comparison ?

\n
if echo $myvar | grep -q "hello world"; then ...\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Back to the program

\n

We officially have our files being ran and we have filtering, and this is great.

\n

But what if we need to debug this bash script? We don't really have a way\nother than add a bunch of print statements and potentially run some side\neffects we were not expecting

\n

We need a dry_run, so lets write it now!

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n

Here is the full code up to this point

\n
#!/usr/bin/env bash\n\nscript_dir="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"\nfilter=""\ndry="0"\n\ncd $script_dir\nscripts=$(find runs -maxdepth 1 -mindepth 1 -executable -type f)\n\nwhile [[ $# > 0 ]]; do\n    if [[ "$1" == "--dry" ]]; then\n        dry="1"\n    else\n        filter="$1"\n    fi\n    shift\ndone\n\nlog() {\n    if [[ $dry == "1" ]]; then\n        echo "[DRY_RUN]: $@"\n    else\n        echo "$@"\n    fi\n}\n\nexecute() {\n    log "execute: $@"\n    if [[ $dry == "1" ]]; then\n        return\n    fi\n\n    "$@"\n}\n\nlog "run: filter=$filter"\n\nfor script in $scripts; do\n    if echo "$script" | grep -qv "$filter"; then\n        log "filtered: $filter -- $script"\n        continue\n    fi\n    log "running script: $script"\n    execute ./$script\ndone\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Boom!

\n

We now have a script that is easily extensible for setting up our environment

\n
    \n
  • You can add as many scripts as you would like
  • \n
  • You can filter which scripts get ran
  • \n
  • You can easily edit those scripts to be exactly what you want
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Some cons

\n
    \n
  • Bash sort of sucks..
  • \n
  • Keeping things up date is easy to forget
      \n
    • this is also why i always copy my environment. i never edit the env files\ndirectly. A good habit for me
    • \n
    \n
  • \n
  • Making it OS independent is a bit of a pain in the ass
      \n
    • i would argue its easier and up to as hard as ansible
    • \n
    \n
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Other thoughts on dry runs

\n

You export DRY_RUN during the dry run checks and then run every script and\nlet your scripts be the ones that tell you what it would be doing instead of\ndoing it.

\n

I just find that amount of logic is nice on paper but a huge pain in practice

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## Reinvent the wheel\nI love reinventing the wheel. There are many reasons why i like doing it too!\n\n
\n
\n\n### You will gain\n* a new appreciation of what it takes to create software\n* learn a bunch about the topic along the way\n* become a better engineer yourself, meaning you will now be able to guage\n problems more accurately\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## My Current Bash Setup\nThis is obviously subject to change. About once a year to every two years I\ntry to rethink through everything I have done and see if its something i like\nor hate. That way I can continue to improve my system but I don't end up\nbecoming a meme of the continually pursuit of perfection.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Lets set some goals\n* I want to be able to bootstrap any machine i will purchase in the future that\n is ubuntu based.\n * i am not going to be clever and try to do a multiOS style, though this\n isn't hard its just tedious\n * if i need a mac install script i am sure i can create a mac version\n* I want to be able to install all my favorite libraries\n* I want the repos that i actively maintained brought down\n* I want to be able to build neovim from source\n* I want all the tools i use available\n* I want to copy all my dotfiles over to my env. i like them separated.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## I just want it all\nI really just want to automate my system with the greatest automation language\nof all time...\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\nbash\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Rolling out own\nThere are other versions of this exact same project that is someone elses\nversion. I want to emphasize that I think the more you own of your system the\nbetter it will be because its exactly the way you want it. You have the power\nto fashion it the way you want!\n\n
\n
\n\nBut i am not foolish, this is also a double edge sword where you have to\nmaintain and improve your own system to make continue to make it great.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The idea\nCreate a script called `run` that will, based on some arguments passed in,\nwill run 0 or more scripts. I want to make sure that scripts are easily\norganized so the scripts will be located in a subdirectory called `runs`\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## My version\nIf you want to check out my final version of this product, check out my repo\nnamed [dev](https://github.com/theprimeagen/dev)\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Argument parsing and script setup\nNow we need to write the ackshual run script. Lets start with first creating\nthe dev environment. Meaning getting the libraries, projects, editor, etc etc\nthat we want on our machine.\n\n*Perhaps a bit of white boarding could be useful here...*\n\n* create a project directory anywhere you deem fit\n* create a script called `run` within the directory you just created and make it executable (chmod +x run) within\n* open up your favorite text editor neovim (maybe something else...)\n\n
\n
\n\n### Start simple\n* code up something that allows us to know the current directory and take in 1\nargument for filtering of tasks\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\n```bash\n#!/usr/bin/env bash\n\nscript_dir=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" &> /dev/null && pwd )\"\necho \"$script_dir\"\n\nfilter=\"$1\"\n\necho \"Run: dir $script_dir -- filter \\\"$filter\\\"\"\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## But how do we run scripts?\n* we need to use our current script location to figure out all the available\n scripts and run them one by one and if we have a mask/filter/grep then use\n that to prevent any extra execution\n\n* coding time...\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\n\n```bash\n# ... previous section ...\nscript_dir=\"$(cd $(dirname \"${BASH_SOURCE[0]}\") && pwd)\"\nfilter=\"$1\"\n\ncd $script_dir\nscripts=$(find runs -maxdepth 1 -mindepth 1 -executable -type f)\n\nfor script in $scripts; do\n if echo \"$script\" | grep -qv \"$filter\"; then\n echo \"filtered: $filter -- $script\"\n continue\n fi\n ./$script\ndone\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Quick Note\nwhy single bracket comparison ?\n\n```bash\nif [ ! -z \"$myvar\" ]; then ...\n```\nwhy double bracket comparison ?\n\n```bash\nif [[ $myvar == \"\" ]]; then ...\n```\n\nwhy no bracket comparison ?\n\n```bash\nif echo $myvar | grep -q \"hello world\"; then ...\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Back to the program\nWe officially have our files being ran and we have filtering, and this is great.\n\nBut what if we need to debug this bash script? We don't really have a way\nother than add a bunch of print statements and potentially run some side\neffects we were not expecting\n\nWe need a `dry_run`, so lets write it now!\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\nHere is the full code up to this point\n\n```bash\n#!/usr/bin/env bash\n\nscript_dir=\"$(cd $(dirname \"${BASH_SOURCE[0]}\") && pwd)\"\nfilter=\"\"\ndry=\"0\"\n\ncd $script_dir\nscripts=$(find runs -maxdepth 1 -mindepth 1 -executable -type f)\n\nwhile [[ $# > 0 ]]; do\n if [[ \"$1\" == \"--dry\" ]]; then\n dry=\"1\"\n else\n filter=\"$1\"\n fi\n shift\ndone\n\nlog() {\n if [[ $dry == \"1\" ]]; then\n echo \"[DRY_RUN]: $@\"\n else\n echo \"$@\"\n fi\n}\n\nexecute() {\n log \"execute: $@\"\n if [[ $dry == \"1\" ]]; then\n return\n fi\n\n \"$@\"\n}\n\nlog \"run: filter=$filter\"\n\nfor script in $scripts; do\n if echo \"$script\" | grep -qv \"$filter\"; then\n log \"filtered: $filter -- $script\"\n continue\n fi\n log \"running script: $script\"\n execute ./$script\ndone\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Boom!\nWe now have a script that is easily extensible for setting up our environment\n\n* You can add as many scripts as you would like\n* You can filter which scripts get ran\n* You can easily edit those scripts to be exactly what you want\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Some cons\n* Bash sort of sucks..\n* Keeping things up date is easy to forget\n * this is also why i always copy my environment. i never edit the env files\n directly. A good habit for me\n* Making it OS independent is a bit of a pain in the ass\n * i would argue its easier and up to as hard as ansible\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Other thoughts on dry runs\nYou `export DRY_RUN` during the dry run checks and then run every script and\nlet your scripts be the ones that tell you what it would be doing instead of\ndoing it.\n\nI just find that amount of logic is nice on paper but a huge pain in practice\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"roll-your-own","title":"Reinvent the wheel","section":"Your Env","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/C-roll-your-own.md","nextSlug":"/dev-prod-2/lessons/your-env/neovim","prevSlug":"/dev-prod-2/lessons/your-env/ansible"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/wait.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/wait.json new file mode 100644 index 0000000..acd5e2e --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/wait.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Wait A Second","description":"what about all the dot files?"},"html":"

We only have talked about getting the software up

\n

What about dotfiles...\nWhat about configuration...\nWHAT ABOUT MY CUSTOMIZATIONS

\n
\n
\n\n

For those unfamiliar with the term dotfiles, it simple means a script that is\nran at the start of your program. A .bashrc / .zshrc / .vimrc are all\nexamples of dotfiles that run before the program startup is complete. It is\nthe place for you to register your custom functionality or to alter program\nbehavior

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Well we already have everything we need

\n

We have everything we need to get started, we have our reliable environmental\nscript to run, we just need one script that sets up our environment!

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The Env Idea

\n
    \n
  • make a script that installs all the environment files.
  • \n
  • make one or more directories to where you like to install files to
  • \n
\n
\n
\n\n

Lets do this!

\n
    \n
  • whiteboard time!
  • \n
  • code time!
  • \n
  • lets start by getting the basics of the script ready
      \n
    • dry run
    • \n
    \n
  • \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n
#!/usr/bin/env bash\n\nscript_dir="$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)"\ndry="0"\n\nwhile [[ $# > 0 ]]; do\n    if [[ "$1" == "--dry" ]]; then\n        dry="1"\n    fi\n    shift\ndone\n\nlog() {\n    if [[ $dry == "1" ]]; then\n        echo "[DRY_RUN]: $@"\n    else\n        echo "$@"\n    fi\n}\n\nexecute() {\n    log "execute: $@"\n    if [[ $dry == "1" ]]; then\n        return\n    fi\n\n    "$@"\n}\n\nlog "--------- dev-env ---------"\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Copy time

\n

Lets create the copy function that will bring over every source directory to\nthe target directory

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected code

\n
cd $script_dir\ncopy_dir() {\n    pushd $1\n    to=$2\n    dirs=$(find . -maxdepth 1 -mindepth 1 -type d)\n    for dir in $dirs; do\n        execute rm -rf $to/$dir\n        execute cp -r $dir $to/$dir\n    done\n    popd\n}\n\ncopy_dir .config $XDG_CONFIG_HOME\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

And just like that

\n

We have ourselves a way to copy over directories for all of our programs... but\nwhat about one off scripts?

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

Expected Code

\n
copy_file() {\n    file=$1\n    to=$2\n    execute rm $to/$file\n    execute cp $file $to\n}\n\ncopy_file .specialrc ~/\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

We make things bigger than they are

\n

this will solve about 99% of all dotfile management issues.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","markdown":"\n## We only have talked about getting the software up\nWhat about dotfiles...\nWhat about configuration...\nWHAT ABOUT MY CUSTOMIZATIONS\n\n
\n
\n\nFor those unfamiliar with the term dotfiles, it simple means a script that is\nran at the start of your program. A `.bashrc` / `.zshrc` / `.vimrc` are all\nexamples of dotfiles that run before the program startup is complete. It is\nthe place for you to register your custom functionality or to alter program\nbehavior\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Well we already have everything we need\nWe have everything we need to get started, we have our reliable environmental\nscript to run, we just need one script that sets up our environment!\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The Env Idea\n* make a script that installs all the environment files.\n* make one or more directories to where you like to install files to\n\n
\n
\n\n### Lets do this!\n* whiteboard time!\n* code time!\n* lets start by getting the basics of the script ready\n * dry run\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\n```bash\n#!/usr/bin/env bash\n\nscript_dir=\"$(cd $(dirname \"${BASH_SOURCE[0]}\") && pwd)\"\ndry=\"0\"\n\nwhile [[ $# > 0 ]]; do\n if [[ \"$1\" == \"--dry\" ]]; then\n dry=\"1\"\n fi\n shift\ndone\n\nlog() {\n if [[ $dry == \"1\" ]]; then\n echo \"[DRY_RUN]: $@\"\n else\n echo \"$@\"\n fi\n}\n\nexecute() {\n log \"execute: $@\"\n if [[ $dry == \"1\" ]]; then\n return\n fi\n\n \"$@\"\n}\n\nlog \"--------- dev-env ---------\"\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Copy time\nLets create the copy function that will bring over every source directory to\nthe target directory\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected code\n```bash\ncd $script_dir\ncopy_dir() {\n pushd $1\n to=$2\n dirs=$(find . -maxdepth 1 -mindepth 1 -type d)\n for dir in $dirs; do\n execute rm -rf $to/$dir\n execute cp -r $dir $to/$dir\n done\n popd\n}\n\ncopy_dir .config $XDG_CONFIG_HOME\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## And just like that\nWe have ourselves a way to copy over directories for all of our programs... but\nwhat about one off scripts?\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## Expected Code\n```bash\ncopy_file() {\n file=$1\n to=$2\n execute rm $to/$file\n execute cp $file $to\n}\n\ncopy_file .specialrc ~/\n```\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## We make things bigger than they are\nthis will solve about 99% of all dotfile management issues.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n","slug":"wait","title":"Wait A Second","section":"Your Env","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/E-wait.md","nextSlug":"/dev-prod-2/lessons/navigation/window","prevSlug":"/dev-prod-2/lessons/your-env/neovim"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/your-env.json b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/your-env.json new file mode 100644 index 0000000..fc585e6 --- /dev/null +++ b/_next/data/bDDKiCGkIexFAZGQ7QWXD/lessons/your-env/your-env.json @@ -0,0 +1 @@ +{"pageProps":{"post":{"attributes":{"title":"Intro into your env","description":"lets take a tour"},"html":"

The Environment

\n

So for me, when i say environment what i mean is everything surrounding the\ndevelopment process.\n
\n

\n

How you install your favorite libraries\n
\nHow you interact with your operating system to get you where you want to be\n
\nHow you arrange your windows\n
\nHow you arrange your screens (desktops?)\n

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n

The most important starting place

\n

If you were given a brand new system how long does it take you set up? I would\nventure that most people spend a day getting ready to go followed by another\ncouple days patching the holes.

\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n","markdown":"\n## The Environment\nSo for me, when i say environment what i mean is everything surrounding the\ndevelopment process.\n
\n
\n\nHow you install your favorite libraries\n
\nHow you interact with your operating system to get you where you want to be\n
\nHow you arrange your windows\n
\nHow you arrange your screens (desktops?)\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n## The most important starting place\nIf you were given a brand new system how long does it take you set up? I would\nventure that most people spend a day getting ready to go followed by another\ncouple days patching the holes.\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n","slug":"your-env","title":"Intro into your env","section":"Your Env","icon":"info-circle","filePath":"/home/runner/work/dev-prod-2/dev-prod-2/lessons/02-your-env/A-your-env.md","nextSlug":"/dev-prod-2/lessons/your-env/ansible","prevSlug":"/dev-prod-2/lessons/intro/intro"}},"__N_SSG":true} \ No newline at end of file diff --git a/_next/static/bDDKiCGkIexFAZGQ7QWXD/_buildManifest.js b/_next/static/bDDKiCGkIexFAZGQ7QWXD/_buildManifest.js new file mode 100644 index 0000000..b47cd6c --- /dev/null +++ b/_next/static/bDDKiCGkIexFAZGQ7QWXD/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/pages/index-49a3879d914cc49e.js"],"/_error":["static/chunks/pages/_error-77823ddac6993d35.js"],"/lessons/[section]/[slug]":["static/chunks/pages/lessons/[section]/[slug]-7e79801f4e913ad6.js"],sortedPages:["/","/_app","/_error","/lessons/[section]/[slug]"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/_next/static/bDDKiCGkIexFAZGQ7QWXD/_ssgManifest.js b/_next/static/bDDKiCGkIexFAZGQ7QWXD/_ssgManifest.js new file mode 100644 index 0000000..10f162a --- /dev/null +++ b/_next/static/bDDKiCGkIexFAZGQ7QWXD/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set(["\u002F","\u002Flessons\u002F[section]\u002F[slug]"]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB() \ No newline at end of file diff --git a/_next/static/chunks/framework-ecc4130bc7a58a64.js b/_next/static/chunks/framework-ecc4130bc7a58a64.js new file mode 100644 index 0000000..3b13c66 --- /dev/null +++ b/_next/static/chunks/framework-ecc4130bc7a58a64.js @@ -0,0 +1,33 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[774],{4448:function(e,n,t){/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var r,l,a,u,o,i,s=t(7294),c=t(3840);function f(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t