site

A custom static site generator written in C.
git clone https://unitehenry.com/git/site.git
Log | Files | Refs | README

commit e548dcc6414b87808a9bed962cc3f6dc8741f0f1
parent f4e49a6211d7bd6c3f1dafec1f49f76b6fea02b6
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sun, 12 Apr 2026 19:30:53 +0000

feat: init blog section

Diffstat:
Acontent/blog/ai-2025.md | 46++++++++++++++++++++++++++++++++++++++++++++++
Acontent/blog/building-my-portfolio-website-with-nextjs.md | 244+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/blog/domain-driven-test-pipelines.md | 246+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dcontent/blog/first-post.md | 7-------
Acontent/blog/hyprland-for-dgpu-laptop.md | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/blog/index.md | 11+++++++++++
Acontent/blog/money-25.md | 145+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dcontent/blog/nested/nested-1.md | 1-
Acontent/blog/striven-editor.md | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/blog/whats-in-my-rc-2021.md | 197+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/blog/whats-in-my-rc-2022.md | 321+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/blog/working-hard.md | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 files changed, 1493 insertions(+), 8 deletions(-)

diff --git a/content/blog/ai-2025.md b/content/blog/ai-2025.md @@ -0,0 +1,46 @@ +--- +title: AI (2025) +description: My thoughts on AI in the year 2025. +--- + +## AI (2025) + +2025-04-19 + +In the year 2025, here are some of my thoughts around the influence of "AI" in the world of software development. + +## Machine Learning + +AI is a marketing term; machine learning is a technology. + +AI is a marketing term you slap onto a product, or company, that is strapping the ChatGPT API onto a legacy system or fork of VS Code. + +## Writing Code + +A software engineer is not limited by the amount of code they can write. If they are, they're a bad software engineer. The skill involved with software engineering revolves around cutting scope, deleting requirements, and building systems that integrate with other systems. + +That's not to say AI won't be able to do this in the future. But that's *really* far away. + +## Predicting + +An LLM works by stringing together symbols probabilistically from information that already exists. The vast majority of the code you write shouldn't be able to be generated this way, and if it is, you're probably not working on anything interesting or useful. + +This section was inspired by a [Jonathan Blow rant](https://www.youtube.com/watch?v=c1TTqHUxIF8). + +## Layoffs + +When a company lays off employees due to "efficiencies with AI" or "AI is replacing software engineers," that's just an excuse to layoff people in their organization who weren't adding value to begin with. + +## Mediocre Engineers + +AI makes mediocre engineers less mediocre. Personally, I have not found a single useful AI tool that I can add to my workflow to make me even a 1% more productive. + +Copilots and AI editors allow mediocre engineers to abandon first principles* and write shit code. + +*\*as if they ever had first principles to begin with.* + +## A Generation of Software Engineers + +I think we might be on the verge of loosing a generation of software engineers with first principles knowledge, especially domestically in the United States. + +The same way we take hardware, operating systems, compilers, etc. for granted - I believe this effect is working its way up the software stack through means of AI. diff --git a/content/blog/building-my-portfolio-website-with-nextjs.md b/content/blog/building-my-portfolio-website-with-nextjs.md @@ -0,0 +1,244 @@ ++++ +title = "Building My Portfolio Website With Nextjs" +date = "2020-11-20" +tags = [] ++++ + +It's time for a new portfolio website! This time I decided to use Next.js to generate my static site with these principles in mind: + +1. Take a [README](https://github.com/unitehenry/unitehenry/blob/master/README.md) markdown file of my resume and convert it to a static homepage +2. Use [semantic HTML](https://www.w3schools.com/html/html5_semantic_elements.asp) with global styles for easy customization +3. Adding [next pages](https://nextjs.org/docs/basic-features/pages) will append links to the homepage + +## README Conversion + +The core concepts of this project are built on the foundation of these methods: + +1. Bootstrap a [create-next-app](https://nextjs.org/docs/api-reference/create-next-app) +2. Use the [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching) to generate HTML from the README with [showdown](https://github.com/showdownjs/showdown) +3. Use [dangerouslySetInnerHTML](https://reactjs.org/docs/dom-elements.html) for SEO optimization + +### Getting Started with Next + +We can start bootstrapping our application using the [create-next-app](https://nextjs.org/docs/api-reference/create-next-app) npm script. + +{{< highlight bash >}} +$ npx create-next-app +{{< / highlight >}} + +### Generating HTML from README + +Using [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching) and [showdown](https://github.com/showdownjs/showdown), we can generate some HTML to use for our site generation. + +{{< highlight js >}} +export async function getStaticProps() { + const path = require('path'); + const fs = require('fs'); + const { Converter } = require('showdown'); + const converter = new Converter(); + + function parseREADME() { + return new Promise((res) => { + fs.readFile(path.join(process.cwd(), 'README.md'), (err, data) => { + const readme = data.toString(); + const html = converter.makeHtml(pReadme); + res(html); + }); + }); + } + + const html = await parseREADME(); + + return { + props: { html }, + }; +} +{{< / highlight >}} + +### Serving HTML optimized for SEO + +The key to using [dangerouslySetInnerHTML](https://reactjs.org/docs/dom-elements.html) with next.js is that we want to ensure the content of our HTML is served as static content for SEO. + +{{< highlight jsx >}} +return ( + <div> + <Head> + <title> {title} </title> + <link rel="icon" href="/favicon.ico" /> + </Head> + + <main dangerouslySetInnerHTML={{ __html: html }} /> + + <footer> + + </footer> + </div> + ); +{{< / highlight >}} + +## Semantic Styling + +After your content is being injected in the page, you should be staring at a wall of black and white text like this: + +!["Unstyled README Homepage"](/images/b568ca02-3d59-4bf6-8633-8f88d1823de5.png) + +Using the [global.css](https://nextjs.org/docs/basic-features/built-in-css-support) file provided by next, we can globally style semantic elements like this: + +{{< highlight css >}} +body { + /* CSS Styles */ +} + +main { + /* CSS Styles */ +} + +main hr { + /* CSS Styles */ +} + +main strong { + /* CSS Styles */ +} + +main p { + /* CSS Styles */ +} + +main h1, main h2, main h3, main h4, main h5, main h6 { + /* CSS Styles */ +} + +main ul, main ol { + /* CSS Styles */ +} + +main li { + /* CSS Styles */ +} + +main a { + /* CSS Styles */ +} +{{< / highlight >}} + +## Page Extensibility + +One of the design concepts I wanted to implement was the idea that you could add a next page in the pages directory and a navigation link be appended to the homepage. + +Taking advantage of the the [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching) function, we can use node to read the directory, exclude unrelated files, and generate links in our homepage. + +{{< highlight javascript >}} +// CONFIG['pageExcludes'] = [ 'app', 'api', 'index'] + + function getPages() { + return new Promise((res) => { + fs.readdir(path.join(process.cwd(), 'pages'), (err, data) => { + const pageFiles = data.filter((f) => { + return !CONFIG['pageExcludes'].filter((ex) => f.includes(ex)).pop(); + }); + + res(pageFiles.map((p) => p.replace('.js', ''))); + }); + }); + } + + const html = await parseREADME(); + const pages = await getPages(); + + return { + props: { html, pages }, + }; +{{< / highlight >}} + +{{< highlight jsx >}} + <footer> + <div id="pages"> + { pages.map((p) => p ? <a key={p} href={`/${p}`}>{ p }</a> : null } + </div> + </footer> +{{< / highlight >}} + +### Gathering my Blog Post Data + +With this feature, I can now create unique CMS pages to extend my static site. Let's create a blog page to fetch my DEV posts. + +I'll be using the [axios](https://github.com/axios/axios) library to make a request to the DEV api, gather my posts data, and send those props to the page for static site generation. Again, taking advantage of the [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching) hook. + +{{< highlight javascript >}} +// pages/blog.js + +export async function getStaticProps() { + const axios = require('axios'); + + function getArticle() { + return new Promise(async (res) => { + const req = await axios({ + method: 'GET', + url: 'https://dev.to/api/articles?username=unitehenry' + }); + + if(req['data']) { + try { + const data = req['data']; + res(data.map((article) => { + return { + title: article['title'], + description: article['description'], + url: article['url'], + date: article['created_at'], + image: article['cover_image'] + }; + })); + } catch(e) { + res([]); + } + } else { + res([]); + } + }); + + } + + const articles = await getArticle(); + + return { + props: { articles } + } +} +{{< / highlight >}} + +{{< highlight jsx >}} + <section> + + { (articles.length === 0) && <p>No Blog Posts</p>} + + { + articles.map(({ title, description, date, url, image }) => { + return ( + <article key={title} className={style['blog-article']}> + { image ? <img src={image} /> : null} + <div className={style['blog-article-content']}> + <h2>{ title }</h2> + <p>{ description }</p> + <a title="Read Article" className={style['blog-button']} href={url} target="_blank">Read Article</a> + </div> + </article> + ); + }) + } + + </section> +{{< / highlight >}} + +!["Portfolio Footer Pages"](/images/7f6ed5e9-a9b8-45bb-b91a-43686d661b42.png) + +## Bootstrapping of my Repository + +If you want to see the source code or fork this repo and generate your own static site, I've created a [GitHub repository](https://github.com/unitehenry/unitehenry) and [documented in detail](https://github.com/unitehenry/unitehenry/wiki) how to customize the code for your own static portfolio site. + +### GitHub Trick + +As a side note, there is a [GitHub trick](https://docs.github.com/en/free-pro-team@latest/github/setting-up-and-managing-your-github-profile/managing-your-profile-readme) that will take your README and display it on your GitHub profile as well. + +!["GitHub Profile"](/images/3f889b6e-e224-44d1-b895-f3cf2462800c.png) diff --git a/content/blog/domain-driven-test-pipelines.md b/content/blog/domain-driven-test-pipelines.md @@ -0,0 +1,246 @@ ++++ +title = "Domain-Driven Test Pipelines" +date = "2025-09-13" +description = "Parallelizing tests by domain with matrix strategies." +tags = [] ++++ + +When building CI pipelines, a [matrix strategy](https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/run-job-variations) is a configuration setup that allows a CI system to run multiple tests or build jobs in parallel with different combinations of parameters. For example, building by operating systems, programming language versions, or environment settings. Typically these are used to run tests against multiple environments and versions of software. For example, running python tests across different versions of python on different operating systems. + +```yaml +jobs: + example_matrix: + strategy: + matrix: + python_version: [10, 12, 14] + os: [ubuntu-latest, windows-latest] +``` + +In theory, a domain-driven project will have their tests logically divided into these groupings as well. + +```plaintext +com/example/api/ +├── src/ +│ ├── user/ +│ │ ├── service/ +│ │ ├── repository/ +│ │ ├── controller/ +│ ├── order/ +│ │ ├── service/ +│ │ ├── repository/ +│ │ ├── controller/ +│ ├── shipping/ +│ │ ├── service/ +│ │ ├── repository/ +│ │ ├── controller/ +├── test/ +│ ├── user/ +│ │ ├── service/ +│ │ ├── controller/ +│ ├── order/ +│ │ ├── service/ +│ │ ├── controller/ +│ ├── shipping/ +│ │ ├── service/ +│ │ ├── controller/ +``` + +As your codebase grows and your tests grow with it, any tests that require external dependencies may become resource constrained. For example, attempting to run parallel tests against the same instance of postgres. There are two bottlenecks that can occur in this situation: +- Limited amounts of tests can run in parallel +- Limited database connections can be opened and shared across tests + +What if we leveraged the build matrix mechanism to run these tests in parallel? Each domain would run it's tests with it's own DB instance and in isolation of other domains. + +## Parametrizing Test Jobs + +If you're using [GitHub Actions](https://docs.github.com/en/actions), it's common to use [reusable workflows](https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows) to reuse existing snippets of steps to run your jobs. This is especially useful when parametrizing the domain of tests that we intend to run. + +### Gradle Example + +```yaml +# .github/workflows/test.yml + +on: + workflow_call: + inputs: + domain: + required: true + type: string + +jobs: + unit_test: + runs-on: depot-ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Setup Java 21 + uses: actions/setup-java@v4.5.0 + with: + distribution: 'corretto' + java-version: '21' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: '8.14.3' + + - name: Run Gradle Test + run: ./gradlew test --tests='com.example.api.${{ inputs.domain }}.*' +``` + +As an example, you may have a gradle project and a CI you want run gradle tests on. Instead of running `./gradlew test` and having your whole suite of tests run asynchronously top-to-bottom, we can leverage a reusable workflow to run only a subset of tests based on domain. + +## Domain Matrix + +```yaml +# .github/workflows/feature + +jobs: + test: + uses: .github/workflows/test.yml + with: + domain: ${{ matrix.domain }} + strategy: + matrix: + domain: + - user + - order + - shipping +``` + +Now that we have a reusable workflow for running our tests, we can use a matrix strategy and run each domains set of tests in parallel of each other. + +## Enforcing Domain Test Coverage + +```python +#! /usr/bin/env python + +import os +import yaml + +def is_domain_covered(domain, test_domains): + for test_domain in test_domains: + if domain in test_domain: + return True + return False + +if __name__ == '__main__': + with open('.github/workflows/feature.yml', 'r') as workflow_file: + workflow = yaml.load(workflow_file, Loader=yaml.FullLoader) + + test_domains = workflow['jobs']['test']['strategy']['matrix']['domain'] + + domains = os.listdir('com/example/src') + + for domain in domains: + if not is_domain_covered(domain, test_domains): + raise Exception(f'The {domain} domain is not covered in tests') +``` + +What if we introduce a new domain to our project? Surely, we want enforce that all domains are covered when we run our tests via a matrix strategy. Here's a python example of a simple bash script we can use to parse the matrix strategy yaml array and verify it covers each domain directory of our project. + +```yaml +jobs: + domain_coverage: + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Verify Domain Test Coverage + run: ./scripts/test/domain_test_coverage.sh + + test: + needs: [ domain_coverage ] + uses: .github/workflows/unit-test.yml + with: + domain: ${{ matrix.domain }} + strategy: + matrix: + domain: + - user + - order + - shipping +``` + +Now we can run this bash script before the matrix strategy job runs, to verify that all domains are covered with any incoming changes to our project. + +## Omitting Irrelevant Domains Per Feature + +```yaml +on: + workflow_call: + inputs: + domain: + required: true + type: string + +jobs: + unit_test: + runs-on: depot-ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Determine If Test Is Needed + id: test_needed + run: | + git fetch origin main; + + INPUT_DOMAIN=$(echo '${{ inputs.domain }}' | cut -f 1 -d '.' -) + + if [ $(git diff origin/main --name-only | grep $INPUT_DOMAIN | wc | awk '{ print $1 }') -ne 0 ]; then + echo "is-test-needed=true" >> "$GITHUB_OUTPUT"; + else + # Run all tests when merged to main + if [ $(git branch --show-current) == 'main' ]; then + echo "is-test-needed=true" >> "$GITHUB_OUTPUT"; + else + echo "is-test-needed=false" >> "$GITHUB_OUTPUT"; + fi + fi + + - name: Setup Java 21 + if: steps.test_needed.outputs.is-test-needed == 'true' + uses: actions/setup-java@v4.5.0 + with: + distribution: 'corretto' + java-version: '21' + + - name: Setup Gradle + if: steps.test_needed.outputs.is-test-needed == 'true' + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: '8.14.3' + + - name: Run Gradle Test + if: steps.test_needed.outputs.is-test-needed == 'true' + run: ./gradlew test --tests='com.example.api.${{ inputs.domain }}.*' +``` + +Now that we're running tests based on domain, we can conditionally run tests for features that might not impact other domains. By checking the files included in a `git diff`, we can check if the `inputs.domain` is included with the files being changed, and only then run tests as needed. + +This is a great way to reduce billable CI minutes. + +**Note:** You still will likely want to run all tests after the feature is merged. + +## Benefits + +```bash +$ gradle test --parallel +``` + +Given the gradle example earlier, build tools might have parallel testing mechanisms like [`--parallel`](https://docs.gradle.org/current/userguide/performance.html#sec:enable_parallel_execution). These very well may work out of the box for different projects, but some issues I've encountered in the past when leveraging these mechanisms are: +- External dependencies be constrained to run the tests in parallel +- Threads used for tests constrained by the amount of CPU cores the runners have + +When parallelizing tests by project domain, here are some of the benefits that these changes yield: +- Physical isolation of resources and domains per set of tests, reducing resource constraints like database connections +- Run more tests in parallel, reducing the time it takes for developers to get feedback on their features +- Less tests ran on a per feature basis, reducing billable CI minutes diff --git a/content/blog/first-post.md b/content/blog/first-post.md @@ -1,7 +0,0 @@ ---- -title: My First Blog Post ---- - -# First Post - -This is my first blog post. diff --git a/content/blog/hyprland-for-dgpu-laptop.md b/content/blog/hyprland-for-dgpu-laptop.md @@ -0,0 +1,110 @@ ++++ +title = "Hyprland on dGPU Laptop" +date = "2025-11-14" +description = "Hyprland on dGPU Laptop" +tags = [] ++++ + +!["Amazon Laptop"](/images/4743cffc-b34b-415c-8333-1e6f47be1efc.png) + +Last year I bought this laptop to dual-boot Archlinux and Windows. I bought a dedicated NVMe drive, installed Arch, and setup a GRUB boot partition to switch between OS. + +## My Setup + +I strictly like to use a single monitor and keep my laptop lid shut. So after installing Arch and [Hyprland](https://hypr.land/), booting my laptop with lid shut and directly into Hyprland on my external monitor was problematic. I would have to first open my laptop lid, login to archlinux, and set Hyprland to use my dGPU over the iGPU. + +## The Problem + +After installing Arch and Hyprland, there's a couple problems that come with achieving my ideal setup: + +- [Booting directly into desktop environment](#booting-directly-into-desktop-envrionment) +- [Switching between external monitor or laptop display](#switching-displays) +- [Choosing which OS to boot into](#dual-boot) + +## Booting Directly Into Desktop Environment + +By default, Arch uses [`agetty`](https://man.archlinux.org/man/agetty.8.en) to open a tty port, prompting login, and starting that user's shell. It comes with a `systemd` unit that looks like this: + +``` +[Service] +ExecStart=-/sbin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d - ${TERM} +Type=idle +Restart=always +``` + +One thing nice about `agetty` is that is comes with a `--autologin`, so when my system starts it will open a shell for my user without having to login. With a simple bash script in my user's `.bashrc` file, I can invoke Hyprland at startup. + +```sh +if command -v hyprland > /dev/null 2>&1; then + if [[ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]]; then + hyprland + fi +fi +``` + +First checking if the `hyprland` command exists, then checking the `HYPRLAND_INSTANCE_SIGNATURE` environment variable to know if the bash session is currently running in a Hyprland instance. If it's not, fire up Hyprland! + +## Switching Displays + +So now that my machine can fire up Hyprland from boot without ever having to touch the keyboard, there needs to be a way to know whether Hyprland should use the external monitor or laptop display. The default behavior for this is sending display primarily to the integrated display, and to the external monitor if connected. For my setup, I want it to only use the external monitor if connected. + +### Detecting Monitor + +My laptop has a discrete NVIDIA GPU that has an HDMI port which will be primarily used for connected external monitors. After installing the appropriate [NVIDIA drivers for Arch](https://wiki.archlinux.org/title/NVIDIA), I can detect if there is a display attached. The proprietary NVIDIA drivers come with an [`nvidia-smi`](https://docs.nvidia.com/deploy/nvidia-smi/index.html) utility which can be used to detect if a display is connected by doing the following: + +```sh +$ nvidia-smi --query-gpu display_attached +display_attached +Yes +``` + +By modifying the `.bashrc` script, I can pipe this standard out into bash and use that to detect if Hyprland should prioritize this GPU display: + +```sh +if command -v hyprland > /dev/null 2>&1; then + if [[ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]]; then + DISPLAY_ATTACHED_OUT=$(nvidia-smi --query-gpu display_attached) + + if [[ $DISPLAY_ATTACHED_OUT == *"Yes"* ]]; then + echo "external display connected"; + AQ_DRM_DEVICES="/dev/dri/card1:/dev/dri/card0" hyprland; + else + echo "external display disconnected"; + hyprland + fi + fi +fi +``` + +By setting the [`AQ_DRM_DEVICES`](https://wiki.hypr.land/Configuring/Multi-GPU/) environment variable prior to running `hyprland`, we can tell the compositor to prioritize the dGPU over the integrated Intel GPU. This will result in Hyprland only using the external monitor. + +### Integrated GPU + +Using the dGPU acceleration on the laptop display is something Hyprland does not support out of the box, and setting the `AQ_DRM_DEVICES` does not accomplish this either. This is because the laptop display is connected directly to the iGPU which the BIOS prioritizes over the dGPU by default. There is a UEFI setting that allows you to configure priority over dGPU, but this can only be accomplished if the hardware includes a MUX. + +For my setup, I'm not concerned with GPU acceleration over the laptop display since I use [dual booting](#dual-boot) and do gaming on Windows. + +## Dual Boot + +!["GRUB Menu"](/images/3aeaf408-bf5a-4529-945f-efa8fd1e7e1a.jpg) +{ width="50%" style="display: block; margin: auto" } + +> But if the laptop lid is closed, how do you choose to boot into Windows from the GRUB menu? + +```sh +sudo grub-reboot 2 && reboot; +``` + +By using this bash script, I can do the following to boot into Windows: + +1. Power on the device +2. Boot into Arch +3. Arch seamlessly load into Hyprland +4. NVIDIA SMI detects the monitor +5. Prioritize the dGPU for Hyprland +6. Hyprland sends display to the external monitor +7. Run `grub-reboot` to reboot into Windows + +## Demo + +*todo: film a video of the boot sequence :)* diff --git a/content/blog/index.md b/content/blog/index.md @@ -0,0 +1,11 @@ +# Blog + +- [AI (2025)](ai-2025) +- [Building My Portfolio Website With Nextjs](building-my-portfolio-website-with-nextjs) +- [Domain-Driven Test Pipelines](domain-driven-test-pipelines) +- [Hyprland for dGPU Laptop](hyprland-for-dgpu-laptop) +- [Money (25)](money-25) +- [Striven Editor](striven-editor) +- [What's in my RC 2021](whats-in-my-rc-2021) +- [What's in my RC 2022](whats-in-my-rc-2022) +- [Working Hard](working-hard) diff --git a/content/blog/money-25.md b/content/blog/money-25.md @@ -0,0 +1,145 @@ ++++ +title = "Money (25)" +date = "2024-06-07" +description = "How I Think About Money" +tags = [] ++++ + +This is how I (25 years old and broke\*) currently think about money. + +## Die Dirt Poor, Or Die Super Rich + +> Get Rich or Die Tryin' -- Curtis "50 Cent" Jackson + +I don't really care which way it goes: if I die dirt poor, or if I die super rich. + +I would prefer dying rich. But if I die poor, I just want to make sure I die doing something that brought value to others. + +## Investing + +> The best investment by far is anything that develops yourself, and it’s not taxed at all…Whatever abilities you have can’t be taken away from you. They can’t actually be inflated away from you. -- Warren Buffet + +Here is a breakdown of my portfolio: +- My current skills and the skills I'm developing +- Money saved to build something valuable to people +- [Social capital](#social-capital) + +I'm leaving all my chips on the table. + +All the money I make goes into building something of value in the world. + +If I run out of money, I will [cut my burn](#cut-your-burn) and make more so I can do it again. + +## Don't Own Things + +> Until we have begun to go without them, we fail to realize how unnecessary many things are. We’ve been using them not because we needed them but because we had them. -- Seneca + +Here is a list of my material possessions: +- Phone +- Laptop +- Clothes + +Material possessions are just liabilities in life that burn your money. You have to insure them. You have to perform maintenance on them. They widen your exposure to risk. You have to consider traveling with them, and they weigh you down. + +Personally owning a house or a car is a scam. They are just ways to expose your life to economic conditions. The only place you *need* a house or a car is the suburbs. + +**Do not live in the suburbs!** + +You should live in a city, or a farm. + +I personally do the former. A city is a great place to live because there are jobs, there are ways to commute to jobs without a car, and there are ways to live cheap and ways to live not-cheap depending on your circumstances. + +I keep all my belongings down to a single suitcase. I do this so that I can pick up and move at any moment. I find it important to be ready when opportunity comes knocking on your front door. + +When I was fed-up with my job in Miami and there were not opportunities in that region during those particular market conditions, I was able to pick up and move to San Francisco where opportunity was plentiful. + +## Don't Want Things + +> No person has the power to have everything they want, but it is in their power not to want what they don't have, and to cheerfully put to good use what they do possess. -- Seneca + +TLDR; If you want things, you'll spend your money on bullshit. + +Here are the things I want in life: +- To love my girlfriend. +- To build something that people get value out of. + +As for everything else in life, all I say is: fuck off and leave me alone. + +That being said, we are people, and there are things that are nice to have. + +Here are the things that I find nice to have: +- Designer hoodies +- Dining at nice restaurants +- Living in a nice condo with amenities + +These are things that I don't care if I have or not, but I'll spend my money on if it's within my means. + +## Short Term Living + +I typically will live somewhere (like an Airbnb) for a month, or two, at a time. + +I would rather pay more money and not be obligated to staying in one place, then to pay less money over a longer period of time. + +I want to mitigate my exposure to risk in different economic conditions. So if it is harder to find a job in a particular market condition, I have two options: +- Move to a cheaper place to live and [cut my burn](#cut-your-burn) +- Move to a place with better opportunities + +The last position I want to be in: is one where I have a 12-month lease and the market dictates that I can't continue to afford it halfway through. + +Another reason short-term living is great, is because I don't need to buy furniture. Furniture is another material possession (like cars and houses) that weigh you down. + +## Eating Out + +> We should eat to live, not live to eat. -- Socrates + +I buy coffee everyday; sometimes I buy it two, or three, times a day. + +I think it's important to call out because of the typical "saving $5 on coffee at Starbucks in the morning" saying. + +When I was single, I would order Uber Eats every day because it was convenient. + +If something makes my life more comfortable living, and it's within my means to afford it, then I will just buy it. + +## Social Capital + +> Giving is in essence a flow of your loving self to others. When that happens, it sets up a flow of supportive energy back to you. When we say you must give to receive, it’s not that you give a thing in order to get something. Rather it’s a way of explaining how the abundance of life flows. If you are not feeling that flow of abundance coming to you, then the first thing to ask is if you are creating a flow of giving from yourself. You don’t need to manipulate or control your giving. Simply give what you can with a full heart. And don’t try to control what you will be receiving either. Know that you will automatically receive exactly what you need. -- Deepak Chopra + +It is important to invest in good people that surround you. + +It is intangible, and hard to judge when to do, but I enjoy buying gifts and treating people to nice dinners that have done right by me. + +It is a great way to spread joy, show appreciation, and plant seeds of favor that compound into the future. I don't count my returns, and I don't keep score. + +## Pay Your Taxes + +> Nothing will ever befall me that I will receive with gloom or a bad disposition. I will pay my taxes gladly. Now, all the things which cause complaint or dread are like the taxes of life—things from which, my dear Lucilius, you should never hope for exemption or seek escape. -- Seneca + +> Mo' Money Mo' Problems -- Christopher "The Notorious B.I.G." Wallace + +I don't know who said it better: Biggie or Seneca. But the point is the same. The more successful you are and the more responsibility you have, come with taxes. + +Marrying your girlfriend comes with the tax of buying a ring. + +Surrounding yourself with successful people comes with the tax of doing expensive activities together like going out to dinner. + +There are things in life you just have to pay for whether you like it or not, but usually it's because you're in a fortunate position of having the leftover money to do it. So be grateful, and just pay your taxes. + +## Cut Your Burn + +**Burn** -- The money that is necessary to spend every month to survive, over the money you have saved plus income. + +For the most part, all my money goes to two major categories: rent and food. + +Since these are the two major categories of my spend, then I have two ways to cut my burn: +- [Move to a cheaper place to live (roommates if necessary)](#short-term-living) +- [Don't go out to eat or get food delivered](#eating-out) + +Another tip to cutting your burn, is just don't leave the house. If you're not leaving the house, you're not burning money unnecessarily. + +## Endgame + +The last rule that I follow when it comes to money: is just don't spend more than you make. + +The theme of my philosophy on money: is just focus on doing something you love and delivers value to other people. Everything else is just noise. + +*\* I'm broke, but I'm hustling.* diff --git a/content/blog/nested/nested-1.md b/content/blog/nested/nested-1.md @@ -1 +0,0 @@ -nested content diff --git a/content/blog/striven-editor.md b/content/blog/striven-editor.md @@ -0,0 +1,93 @@ ++++ +title = "Striven Editor" +date = "2019-10-27" +tags = [] ++++ + +## Introduction + +At Striven, we were looking for potential editors that would be suitable for our client side customer portal revamp. In the past, we have always used the [Kendo UI](https://www.telerik.com/kendo-ui) editor. We were dynamically loading these components into our pages, but even then the editor was shipping over 1MB of scripts over the network. + +One of the key features of this portal was its lightweight optimization. When you look at the Kendo UI minified script over the network, you'll notice a whoping 1.3MB are being shipped to the browser. With the editor component alone making up nearly 1MB of that script. + +!["Kendo UI Script Size"](/images/0bcda974-b314-4aaf-b3ac-cc59534b5748.png) + +An editor was a fundamental component of this customer portal, so we wanted to provide a more optimal solution to our users. I was tasked with the research of finding a lighter editor with just as much, or as much as we needed, functionality. + +These were some notable candidates: + +* [Quill](https://quilljs.com/) +* [Froala](https://froala.com/wysiwyg-editor/) +* [TineMCE](https://www.tiny.cloud/features) + +## Quill + +Quill would be great; its open source, inline, and used by top companies. My experience when trying to integrate with the editor invloved the developer push for the adoption of the editor's [delta](https://quilljs.com/docs/delta/) api. + +My advice to anyone trying to include this control in their project is that you'll have a much easier time designing your system with the concept of delta in mind than trying to bring the concept of the quill editor and its delta api into an existing system. + +## Froala and TinyMCE + +So these editors are obviously top tier editors, but usually have some licensing and enterprise support costs that we weren't ready to explore just yet. I never tried to demo or pitch it to my team, but I still think these were candidates worth considering when all else failed. + +## Undertaking a Custom Built Editor + +After working on implementing the ability to mention users in posts and exploring all these different editor solutions, I formed an understanding of the underlying concepts that went into the inner workings of a WYSIWYG editor. My manager was convinced that I was capable of taking on the project of building a tailored editor for Striven, as it would be worth the time and investment to work on this component in house. + +We decided to work on the component in phases. + +What did we need out of the initial phase of the control? + +* Simple Editing Functions (bold, italic, underline, unordered lists) +* File Attachments and Link Insertions +* Mention Support + +With these functionalities in pipeline, editor phase one development was underway. But I decided that I wasn't going to do it alone. + +## The Benefits of Open Source + +With permission from my manager, I decided that open sourcing this control would have the following benefits: + +* Faster development +* Development guidance from the community on building an editor +* Product brand awareness +* Component development independent from the internal system + +The idea was a success\*, as I could gain input from the open source community and work on the component without having to rely on the internal structure of our client side ecosystem. I also learned a lot as a project maintainer and was really proud of the overall traction that the editor had received in early development. + +!["editor github page"](/images/963fcb0b-63ed-44bc-8fcb-a79882ee237d.png) + +\*Even though 13 contributors isn't a terribly significant amount, I still take pride in it 😅 + +## What I Learned From This Project + +!["editor open source demo"](/images/d03e30dd-b964-4199-b2b6-f56168b44b06.png) + +I've been actively maintaining this [code base](https://github.com/striven-erp/striven-editor) for about a year now and if I could given some wisdom to the young software engineer that does it next, this would be the advice I would give: + +Avoid [document.execCommand](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand) + +* It's old, buggy, and just a pain of an API to use +* It's one of those Internet Explorer that still lives to see modern web development + +Start with an engine or library + +* I've explored ways I would've redesigned this component on the [trix](https://github.com/basecamp/trix) engine +* I've considered how nice it would've been to use [`contenteditable`](https://getcontenttools.com/api/content-edit) libraries + +Understand the [Range](https://developer.mozilla.org/en-US/docs/Web/API/Range) API + +* Although I don't see this system going anywhere in future iterations of the browser, I still believe it to be mediocre +* Learning how to use the Range API and [`window.getSelection()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection) will make your life much easier +* Try exploring libraries like [rangy](https://github.com/timdown/rangy) + +## Final Thoughts + +When I reflect on the development of this project, my goal was always to accomplish two things: + +* Allow developers to contribute, collaborate, and learn open source with a smaller scale project +* It's an editor for Striven, not for anything else (but feel free to use it) + +It's satisfying to have the ability of opening an issue and letting someone contribute to this [project](https://github.com/striven-erp/striven-editor). I also enjoy the ability to work on this component in an independent environment from Striven. It lets me flex my ES6 muscles and have all the luxuries of hot reloading, webpack loaders, and working in Vue. + +There are definitely things that I would've done differently, but at the end of the day it does what Striven needs. diff --git a/content/blog/whats-in-my-rc-2021.md b/content/blog/whats-in-my-rc-2021.md @@ -0,0 +1,197 @@ ++++ +title = "What's in My RC 2021" +date = "2021-05-29" ++++ + +Welcome to a tour of my `.zshrc` file! I thought it would be fun to take a dive into the different tools I use to elevate my developer game. + +**If you want to see my whole config, I keep all my setup files on GitHub:** [https://github.com/unitehenry/config](https://github.com/unitehenry/config) + +## Tools I Use + +Before we dive into my configuration, here are the tools I use that help me speed up my tasks as a developer: + +`fzf` | [Fuzzy File Finder](https://github.com/junegunn/fzf) + +`pandoc` | [Pandoc Document Converter](https://pandoc.org) + +`brew` | [MacOS Package Manager](https://brew.sh) + +## The Variables + +{{< highlight bash >}} +# EDITOR +export EDITOR="vi"; +export VISUAL="vi"; + +# iCloud Directory +export DOCS="/Users/henryunite/Library/Mobile Documents/com~apple~CloudDocs"; + +# Work Directory +export WORK="/Users/henryunite/Projects/bicycletransit"; +{{< / highlight >}} + +Pretty straightforward, but these are what I use to: + +* Default editing to be opened in vim +* Reference my iCloud directory which I use to keep all my personal files +* A quick reference to where I keep all my work repositories, notes, projects + +## Credentials + +{{< highlight bash >}} +# Credentials Fetcher +function username() { + export PASS_BACK_PATH=$(pwd); + cd $DOCS/passwords; + echo $(decrypt-file $(fzf) | grep "Username:" | cut -d ":" -f2) | pbcopy; + cd $PASS_BACK_PATH && unset PASS_BACK_PATH; +} + +function password() { + export PASS_BACK_PATH=$(pwd); + cd $DOCS/passwords; + echo $(decrypt-file $(fzf) | grep "Password:" | cut -d ":" -f2) | pbcopy; + cd $PASS_BACK_PATH && unset PASS_BACK_PATH; +} +{{< / highlight >}} + +There are so many chrome extensions, keychains, any ways to access your passwords. I personally encrypt my passwords in my cloud storage so I can access them by utilizing a `aes-256-cbc` decryption tool. + +## File Formatting + +{{< highlight bash >}} +## Code Formatter +function format-file() { + export FILENAME="$(basename $@)"; + export EXTENSION="${FILENAME##*.}"; + + if [ $EXTENSION = 'py' ] + then + yapf --in-place $@; + return 0; + fi + + if [ $EXTENSION = 'php' ] + then + php-cs-fixer fix $@; + rm .php_cs.cache; + return 0; + fi + + npx prettier --write --single-quote $@; + + unset FILENAME; unset EXTENSION; +} +{{< / highlight >}} + +File formatter that handles the languages I use on a day-to-day basis. It gets the job done for most file types including JSON, YAML, and even markdown. + +## Spell Check + +{{< highlight bash >}} +## Spellcheck +function spellcheck-file() { + npx spellchecker-cli --files $@; +} +{{< / highlight >}} + +When you're writing as much markdown documentation as me, you'll want an easy way to spell check your files. + +## What the Commit + +{{< highlight bash >}} +## What the Commit +function wtf() { git commit -am "$(curl http://whatthecommit.com/index.txt)"; } +{{< / highlight >}} + +This is a gimmick, but if you ever just want to commit file changes and you just don't know what to say in the commit message, [what the commit](http://whatthecommit.com/) is just a fun resource to get whacky commit messages. + +## Cheat Sheet + +{{< highlight bash >}} +## Cheat +function cheat(){ curl https://cheat.sh/"$@"; } +{{< / highlight >}} + +There are so many times I use a CLI tool and can't remember simple commands and options that it takes to perform certain tasks. Check out [cheat.sh](https://cheat.sh) if you're looking for an easy way to reference different CLI tools. + +## Document Generation + +{{< highlight bash >}} +## Generate Markdown +function generate-doc() { + cp -rf . /tmp; + if [ -n "$2" ] + then + pandoc -s $1 -c $2 -o "/tmp/$1.html"; + else + pandoc -s $1 -o "/tmp/$1.html"; + fi + open "/tmp/$1.html"; +} + +## Generate Slide +function generate-slide() { + # https://revealjs.com/config/ + pandoc -t revealjs \ + -V progress="false" \ + -V navigationMode="linear" \ + -V transition="none" \ + -s $1 -o "/tmp/$1.html"; + cp -rf . /tmp; + open "/tmp/$1.html"; +} +{{< / highlight >}} + +I use markdown to write documentation all the time, but if I need to send a coworker a document or present a slide with content that is written in markdown, I'll use [pandoc](https://pandoc.org) to generate these intermediary file formats. + +It's really nice to leverage CSS when I want to make my documents look nice or need a clean way to look at markdown files. + +## File Encryption + +{{< highlight bash >}} +## Encrypt : aes-256-cbc +function encrypt-file() { + if [ -z $@ ] + then + echo -n "Enter Encrypt Phrase: "; read -s ENCRYPTINPUT; echo "\n"; + echo $ENCRYPTINPUT | openssl enc -aes-256-cbc; + unset ENCRYPTINPUT; + else + openssl enc -aes-256-cbc -in $@; + fi +} + +## Decrypt : aes-256-cbc +function decrypt-file() { + if [ -z $@ ] + then + openssl enc -d -aes-256-cbc; + else + openssl enc -aes-256-cbc -d -in $@; + fi +} +{{< / highlight >}} + +It's nice to have a quick way to encrypt and decrypt files with sensitive information. + +## Homebrew + +{{< highlight bash >}} +## Homebrew Install Script +function install-homebrew() { /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; } +{{< / highlight >}} + +This is just in my configuration in the event that I just want to install [homebrew](https://brew.sh) without copying and pasting the install script from the website. + +If I have a new Mac I need to setup, it'll make the setup so much easier. + +## Version Managers + +{{< highlight bash >}} +source ~/.nvmrc; +source ~/.rvmrc; +{{< / highlight >}} + +I've been using `nvm` and `rvm` to manage my node and ruby installations. They append rc scripts to load into your base rc file which I extract into their own designated files and load them in at the end. diff --git a/content/blog/whats-in-my-rc-2022.md b/content/blog/whats-in-my-rc-2022.md @@ -0,0 +1,321 @@ ++++ +title = "What's in My RC 2022" +date = "2022-12-19" ++++ + +Welcome to a tour of my `.zshrc` file! I thought it would be fun to take a dive into the different tools I use to elevate my developer game. + +If you want to see my whole config, I keep all my setup files on GitHub: [https://github.com/unitehenry/config](https://github.com/unitehenry/config) + +Also check out last years: [What's in my RC 2021](/blog/whats-in-my-rc-2021) + +# The Variables + +{{< highlight bash >}} +# EDITOR +export EDITOR="vi"; +export VISUAL="vi"; + +# iCloud Directory +export DOCS="/Users/$(whoami)/Library/Mobile Documents/com~apple~CloudDocs"; + +# Work Directory +export WORK="/Users/$(whoami)/Projects/lula"; + +# Vault Address +export VAULT_ADDR=https://vault.stallions.dev/ +{{< / highlight >}} + +* Continuing to use vim, so just exporting my preferred editor variables +* Reference my iCloud directory which I use to keep all my personal files +* Adding an environment variable to help reference [where my company is storing secrets](https://www.vaultproject.io/) + +# Credentials + +{{< highlight bash >}} +# Credentials Fetcher +function op-create() { + op item template get Login > /tmp/login.json; + if [ -n "$3" ] + then + echo $(cat /tmp/login.json | jq -r -c "(.fields[] | select(.id | contains(\"username\"))) .value = \"$2\"") > /tmp/login.json; + echo $(cat /tmp/login.json | jq -r -c "(.fields[] | select(.id | contains(\"password\"))) .value = \"$3\"") > /tmp/login.json; + op item create --template /tmp/login.json --title $1; + else + echo $(cat /tmp/login.json | jq -r -c "(.fields[] | select(.id | contains(\"username\"))) .value = \"$2\"") > /tmp/login.json; + op item create --template /tmp/login.json --title $1 --generate-password; + fi + rm /tmp/login.json; +} + +function op-list() { + op item list --format=json | jq -c -r '.[].title'; +} + +function op-username() { + op item get $@ --format=json | jq -c -r '.fields[] | select(.id | contains("username")) | .value'; +} + +function op-password() { + op item get $@ --format=json | jq -c -r '.fields[] | select(.id | contains("password")) | .value'; +} + +function op-delete() { + op item delete $@; +} +{{< / highlight >}} + +I used to be anti hosted password managers, but I was recommended using 1password and their [CLI client](https://developer.1password.com/docs/cli) to manage my passwords. + +# Code Formatter + +{{< highlight bash >}} +## Code Formatter +function format-file() { + export FILENAME="$(basename $@)"; + export EXTENSION="${FILENAME##*.}"; + + if [ $EXTENSION = 'py' ] + then + yapf --in-place $@; + return 0; + fi + + if [ $EXTENSION = 'php' ] + then + php-cs-fixer fix $@; + rm .php_cs.cache; + return 0; + fi + + if [ $EXTENSION = 'sql' ] + then + npx sql-formatter-cli --file $@ --out $@; + return 0; + fi + + npx prettier --write --single-quote $@; + + unset FILENAME; unset EXTENSION; +} +{{< / highlight >}} + +Using the same code formatter, but added something to handle `sql` files now! + +# Spell Check + +{{< highlight bash >}} +## Spellcheck +function spellcheck-file() { + npx spellchecker-cli --files $@; +} +{{< / highlight >}} + +Handy spellchecker utility through `npx` is always useful. + +# What the Commit + +{{< highlight bash >}} +## What the Commit +function wtf() { git commit -am "$(curl http://whatthecommit.com/index.txt)"; } +{{< / highlight >}} + +For when I don't know what to type in for a commit message. + +# Cheat Sheet + +{{< highlight bash >}} +Cheat Sheet +## Cheat +function cheat(){ curl https://cheat.sh/"$@"; } +{{< / highlight >}} + +When I don't remember how to use a certain utility, this [cheatsheet API](https://cheat.sh/) is always handy. + +# Git + +{{< highlight bash >}} +## Commit Count +function commit-count() { + if [ -n "$1" ] + then + git rev-list --count $1; + else + echo "commit-count <branch-name>"; + fi +} + +Not as useful, but interesting. I use this to get the number of commits on my current working branch. +{{< / highlight >}} + +# Document Generation + +{{< highlight bash >}} +## Generate Markdown +function generate-doc() { + cp -rf . /tmp; + if [ -n "$2" ] + then + pandoc -s $1 -c $2 -o "/tmp/$1.html"; + else + pandoc -s $1 -o "/tmp/$1.html"; + fi + open "/tmp/$1.html"; +} + +## Generate Slide +function generate-slide() { + # https://revealjs.com/config/ + pandoc -t revealjs \ + -V controls="false" \ + -V progress="false" \ + -V navigationMode="linear" \ + -V transition="none" \ + -s $1 -o "/tmp/$1.html"; + cp -rf . /tmp; + open "/tmp/$1.html"; +} + +function mmdc() { + npx @mermaid-js/mermaid-cli $@; +} +{{< / highlight >}} + +Continuing to leverage [pandoc](https://pandoc.org/) whenever I need to create some quick slides or a document. + +# Homebrew Install + +{{< highlight bash >}} +## Homebrew Install Script +function install-homebrew() { /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; } +{{< / highlight >}} + +Handy script to install [homebrew](https://brew.sh) on a new machine. + +# Vundle Install + +{{< highlight bash >}} +## Vundle Install Script +function install-vundle() { + git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim; + sudo gem install vundle-cli; + if ! grep -Fxq 'set rtp+=~/.vim/bundle/Vundle.vim' ~/.vimrc + then + echo "\nset nocompatible\nfiletype off\nset rtp+=~/.vim/bundle/Vundle.vim\ncall vundle#begin()\n\nPlugin 'VundleVim/Vundle.vim'\n\ncall vundle#end()\nfiletype plugin indent on" >> ~/.vimrc; + fi +} +{{< / highlight >}} + +I use [vundle](https://github.com/VundleVim/Vundle.vim) to manage my vim packages. But this [handy cli](https://github.com/baopham/vundle-cli) makes installing/removing those packages much easier. + +# Docker + +{{< highlight bash >}} +function clear-docker() { + docker system prune -a -f --volumes +} + +function kill-docker() { + killall Docker && open /Applications/Docker.app; +} +{{< / highlight >}} + +For when I just want to wipe docker of all images, containers, and volumes. + +Also something to help restart the docker daemon. + +# Google Cloud Platform + +{{< highlight bash >}} +function gcloud-adc() { + gcloud auth login --update-adc +} + +function use-gcloud-project () { + gcloud config set project "$1"; +} + +function impersonate() { + if [ -z "$1" ]; then + echo "Must provide a service account to impersonate." + return 1 + fi + gcloud config set auth/impersonate_service_account "$1" +} + +function unimpersonate() { + gcloud config unset auth/impersonate_service_account +} + +function connect() { + # Set the context + CONTEXT=${1} + + export PGUSER=$(vault kv get -field=username secrets/${CONTEXT}/postgres-terraform) + export PGPASSWORD=$(vault kv get -field=password "secrets/${CONTEXT}/postgres-terraform") + psql -h 127.0.0.1 -p 54320 -d "${CONTEXT}" +} +{{< / highlight >}} + +* Logging into [Google ADC](https://cloud.google.com/docs/authentication/provide-credentials-adc) +* Setting GCP project to work with +* [Service account impersonation](https://cloud.google.com/iam/docs/impersonating-service-accounts) +* Connect to [cloud sql](https://cloud.google.com/sql) + +# Vault + +{{< highlight bash >}} +function vs() { + # Verify inputs + environment="$1" + if [ "$environment" != "common" ] && [ "$environment" != "staging" ] && [ "$environment" != "production" ]; then + echo "\"$environment\" is not a valid environment." + return 1 + fi + + # Setup + [ ! -d ~/.vault-tokens ] && mkdir ~/.vault-tokens + + # Move the current environment's token to the correct location + if [ -f ~/.vault-tokens/current-environment ] && [ -f ~/.vault-token ]; then + current="$(cat ~/.vault-tokens/current-environment)" + cp ~/.vault-token ~/.vault-tokens/${current} + fi + + # Set the new current environment + echo "${environment}" > ~/.vault-tokens/current-environment + + # Set the correct vault address + if [ "$environment" = "common" ]; then + export VAULT_ADDR="https://vault.stallions.dev" + else + export VAULT_ADDR="https://vault.${environment}.stallions.dev" + fi + + # Get the token from the current environment if it exist + if [ -f ~/.vault-tokens/${environment} ] ; then + cp ~/.vault-tokens/${environment} ~/.vault-token + fi + + # Prompt login if the token is not valid + if ! vault token lookup > /dev/null; then + vault login --method oidc + fi +} +{{< / highlight >}} + +This script helps me switch [vault](https://www.vaultproject.io/) contexts for pulling secrets in different environments like staging and production. + +# Generate ID + +{{< highlight bash >}} +function uuid() { + uuidgen | tr '[:upper:]' '[:lower:]' +} + +function vin() { + echo "$(curl -sS https://randomvin.com/getvin.php\?type\=fake | tr -d '[:space:]')" +} +{{< / highlight >}} + +I use this to create new uuids and new [vin numbers](https://en.wikipedia.org/wiki/Vehicle_identification_number). diff --git a/content/blog/working-hard.md b/content/blog/working-hard.md @@ -0,0 +1,80 @@ ++++ +title = "Working Hard" +date = "2024-06-23" ++++ + +*The topics in this article are tangential to each other. But I just wanted to write down some concepts around my work ethic that I've learned over the years.* + +*I might spin some of these topics out into their own article in the future.* + +--- + +I used to be the kind of person who would work all day and all night out of "survival", or at least that is what I would convince myself. It was a mentality that if I wasn't coding, I could lose it all at any moment. + +## Impostor Syndrome + +One of the reasons I felt the need to work at every waking minute, was because I never finished a traditional four-year degree. I convinced myself that because my peers had a degree in computer science, I would have to work twice as hard to prove that I belonged at whatever job I was working at. + +It wasn't until five years into my career that I realized degrees, universities, and the companies you used to work at don't matter. The only thing that matters is if you have the skills to make a big impact and deliver value. + +All that matters is if you can [move the needle](#focus-on-moving-the-needle). + +## Focus On Moving The Needle + +I have three principles that help guide me in making sure that I'm "moving the needle." + +### Pick Up The Phone + +You should always be talking to your customers. A customer can be more than just an end user; they could be a stakeholder, an engineer, or a product manager. + +This guiding principle is used to ensure that you are always working on the right thing. Don't wait for answers, or make assumptions; pick up the phone, and call the person who is expecting the deliverable you're working on. + +The skill here is not talking to customers. It is the ability to delete requirements. +### Make An Impact + +The goal here is to always make sure you're working on the right thing, and then actually doing the thing (aka writing code). + +How do you know if you're working on the right thing? [Pick up the phone](#pick-up-the-phone) and ask your customer! + +You should only be *working* on things that make an impact. + +### Deliver Value + +High impact, high value; when you actually put the final product in the customer's hands, measure the value it delivers. + +There are two reasons why you want to do this: +- You actually see how impactful the thing you worked on was. +- You have tangible data to validate that you are the right person for the job. + +When you deliver value, the needle moves. + +## Zoom Out + +I used to think everything had to be done in a single day. What I've learned is that it's important to set milestones. + +Instead of tunnel visioning and heads down coding, set a goal like: "by the end of the week, we will have this one thing done." It is the typical "under promise, over deliver." But I treat it as room to maneuver. It doesn't matter how I get there, as long as I deliver it by the time all the stakeholders agreed upon. + +This is a tool to help me focus on [moving the needle](#focus-on-moving-the-needle). + +## In-Person Work + +The way I look at in-person work, especially when it comes to startups, is that if you're going to build something that is going to make an impact in the world, it's not going to happen over a zoom call. + +My opinion: the iPhone could not of been built over a zoom call. + +It's not about being able to get more work done. Yes, you're likely to get more work done in the isolation of your home. + +It's about ensuring that you're always working on the right thing. When people are working in a room together, it's much easier to talk about what everyone is working on and requirements that can be deleted! + +It gives you the ability to always be asking: are we working on the right thing? + +## Waking Up Early vs Staying Up Late + +TLDR; whatever works for you. + +If you feel like it's easier to stay up late and be productive, do that. If you find yourself tired the next day because you decided to stay up late, cool; you can just get even better sleep the following night! + +If you feel like waking up early makes you more productive, do that. + +Again, all that matters is that you [focus on moving the needle](#focus-on-moving-the-needle). +