Joshua's Docs - General Devops And Devtools
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

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

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.
  • Written documentation and guides are great, but don't forget about alternative media, such as YouTube.

    • On YouTube, you can also usually speed up videos by 1.5x or 2x and still be able to understand and learn from it; great time saver!
    • Lots of new tech podcasts coming on as well; these tend to cover broader tech education, rather than a step-by-step guide on how to do xyz.
  • 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
Markdown Source Last Updated:
Sat Jan 02 2021 23:45:09 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