Joshua's Docs - General DevOps and DevTools - Notes
Light

Cmder

Note: Cmder is really a wrapper around ConEmu

Cmder - messed up path

If there is a mismatch between what is accessible in cmder (the terminal that launches from Laragon) and the global git/bin/bash.exe or cmd terminals, it probably has to do with system path variables.

  • Laragon/Cmder has some scripting set up to grab the global %PATH% variable equal to itself + everything in laragon/bin
    • You might to manually add some of these to the system path if you want to use them (for example, NodeJS)
  • There is also a bizarre issue with VSCode and PATH expansion; it is broken for a lot of Windows users unless ran as an administrator
    • This is the case for me; see broken unexpanded results in bash-running-in-vscode with echo $PATH, but running outside of vscode works fine
      • I just set VScode to always run in admin mode
      • See GH issue

Cmder - new tab spawns multiple duplicates

I tend to run into an issue every once in a while with "open new tab" spawning multiple duplicate previous tabs in cmder

  • Seems to happen when there is no "default task for new console"
    • Go into "Settings -> Startup -> Tasks" and then pick a task, such as "{cmd::Cmder as Admin}" and check the box for "Default task for new console"

Cmder - open new tab as admin

-new_console:a

Credit

Local Hosting

For WAMP (or just an always-on localhost for static HTML hosting), I highly recommend Laragon.

Local Static File Hosting - Quick CLIs

If you quickly need to locally host a directory of static files, there are a bunch of options:

  • lwsjs/local-web-server (one of my favorites)
    • NPX: npx local-web-server --directory {path}
    • Regular use:
      • Install globally
      • Call binary ws:
        • Subfolder: ws --directory {path}
        • CWD: ws
    • HTTPS: As easy as using --https or --https2 flags (basic functionality).
    • Supports a ton of options and middleware
  • http-server
    • NPX: npx http-server {path} {options}
    • HTTPS: Follow these steps (requires manually setting up OpenSSL, generating certs, and starting CLI with flags and cert options):
      • Use --ssl, plus:
        • --cert {CERT_FILE_PATH}
        • --key {PRIVATE_KEY_FILE_PATH}
  • Caddy Server (Go powered)
    • Installer /
  • Vercel's Serve Package

💡 Huge cheatsheet here: "Big list of HTTP static server one-liners"

Local Hosting - SSL Certificates

I have written an in-depth guide / cheatsheet on this topic!

Tunneling Requests

For temporarily exposing a local project to the outside world, there are a few options.

For pretty much all of these programs, using Ngrok as an example, they only tunnel / proxy / forward requests from a public URL to a local port. They do not take care of the actual localhost part of responding to requests. For that:

  • For many JS projects, you might already have a serve command, so using Ngrok with your project might look something like:

    • run yarn serve, see that project is now serving on :5000
    • Open new terminal, leaving first open
    • run ngrok http 5000 to start tunneling traffic
  • If you don't have a serve command, and you need to just serve static files, you could use something like the serve package

    • npx serve ./my-site, then ngrok to the port it shows it is using
  • Ngrok

    • Pretty easy syntax; generally all you need to use is ngrok http {localhost_port}
    • Unless you are on the paid plan, you will get a random public URL each time; to use us a fixed URL with the free plan, check out my blog post on using GCP as public proxy point

Local Web Hosting - Mobile Development

If you are building a website / web app, and want to test it on your smartphone, aside from the normal tools at your disposal for request tunneling, deployments, etc. - you also have some unique tools.

For example, if you have an Android phone, you can use Chrome's Remote Debugging tool to handle a large amount of things:

  • Port forwarding local hosted things to your phone
  • Inspecting webpages running on your phone, in real-time
  • And more!

Productivity

Make sure to check out my favorite programs page.

Here are some additional productivity tips / tricks / tools:

  • Don't forget about "scaffolding"
    • If you find yourself writing a lot of boilerplate, check to see if someone else has already created a template file, or better yet, a scaffolding tool that can generate the basic structure
    • If it doesn't exist, that is a great opportunity to create one and share it with the world!
    • Check out tools like Yeoman, which are industry standard for scaffolding new apps / codebases. Yeoman covers over 5K generators!
  • Online codeplaygrounds are great for sharing demos with others, or even just testing little ideas without needing to fire up your IDE, setup a git repo, etc.
  • Official documentation and guides are great, but don't forget about alternative media, such as blogs, StackOverflow, YouTube, forums, etc.
  • Answering questions on StackOverflow can be a good way to brush up on certain skillsets or make sure they stay fresh.
  • Automate!
    • There is a great XKCD chart on whether something is worth the time to automate
    • I would add to this that you should also think about the time saving for others if you share your automation. Could it add to your resume / portfolio, and maybe even get you a job? Or just feel nice about helping others? What is that worth?
  • Take advantage of the open-source repos as a learning tool
    • If you ever wonder "how do the pros do ____?", you should take a look at some Open-Source software that matches what you are looking for.
    • For example, when I was trying to learn some QT and figure out how to structure my project directories (something often glossed over), I realized I could just look at the source for the actual QT IDE to see how QT themselves structured what has to be one of the largest QT projects ever!
    • Chromium and Firefox are both Open-Source and easily navigated online, and both cover a huge amount of different programming uses

Enforcing coding standards / editor configs

A lot of this is specific per language (for example, see js-devops) or per IDE (see vscode), but there are some general tips that are true across languages.

For example, EditorConfig files (.editorconfig) are a cross-IDE solution for declaring some general coding style rules for a given directory/repo, such as tabs vs spaces. On some IDEs, such as WebStorm, it is natively supported, whereas with others, such as Visual Studio Code, a plugin is necessary.


Docker

See my cheatsheet, here


Virtual Box

  • Reminders:
  • You can install guest additions via device menu, and then install into guest
    • This might be necessary to share folders

Laragon

See my notes, here


Cross-Platform Terminals

There aren't many terminals that are cross-platform in a way that includes macOS, Windows, and Linux. Main options are:

As of writing, Alacritty has no split-pane support, Tabby has native support, and Hyper supports through a plugin.

Markdown Source Last Updated:
Tue Aug 24 2021 06:09:01 GMT+0000 (Coordinated Universal Time)
Markdown Source Created:
Thu Dec 05 2019 01:03:44 GMT+0000 (Coordinated Universal Time)
© 2021 Joshua Tzucker, Built with Gatsby
Feedback