Show HN: Useful scripts and environment setup for coding in VPS
github.com
github.com
Then again, these scripts are clearly tailored for OP, since they contain their name and email, so it's... not like these would be usable as-is for anyone else.
(Also, why is this published on Npm?)
It's surprising how many people have used these, so they are for others... Improving them makes sense. If your wanna submit some changes and ideas please do :)
I would really appreciate it, and whoever gets them from npm might too.
I think I pushed to npm because I mostly do node and I guess I figured it's an easy backup and way to distribute.:)
-e : exit immediately if statement has non-zero exit status
-x : echo each command
-u : treat unset variables as an error
-o pipefail : If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully.
that is actually much better than -xe, thank you, I learned something
Tramp is literally magic. It just puts the right text into your buffer, where all the tools you use on your machine are just available by default. Even org exports and the like behave as expected, outputting the resultant file into the correct dir on the remote machine.
I've been using emacs as a <50IQ user for about a year now. I've yet to write a single line of Elisp (apart from use-package declarations). It's awesome!
:eyeroll:
What a horrible attitude. The point of coloring is precisely to help users focus on the output that matters, rather than forcing them to parse and reparse a chunk of stuff they don't care about. If the prompt is colored, my brain can filter it out much faster than if it isn't.
By all means disable color by default for backward-compatibility purposes or to err on the safe side, but don't lecture people with rubbish arguments...
Big world out there. You can have people who like colors and those who don't. Neither have to be pretending they're all that and hate the other. :) Friends?
Please submit a PR with a better comment if you like. I honestly didn't think of that until now, but I think comments are important. Thanks for pointing out really. :)
> You can have people who like colors and those who don't.
I absolutely agree, which is why I'd remove any opinion from the comment. "Default is off". End of story.
# Color variables to make our output a little easier on the eyes. Respect
# NO_COLOR, in case the user does not want any.
if [[ -t 1 && -z "${NO_COLOR:-}" ]]; then
readonly c_red='\033[0;31m'
readonly c_blue='\033[0;34m'
readonly c_green='\033[0;32m'
readonly c_bold='\033[1m'
readonly c_reset='\033[0m'
fi
I have no idea why I added that readonly command there, though, but by now I am
afraid to remove it.The NO_COLOR[2] environment variable is not exactly a standard as far as I know, but it is supported by enough command-line software that it feels like one to me.
I appreciate being able to turn off very colorful output if possible, as it does tend to distract me sometimes. The color schemes I pick/design for myself tend to be muted, while a lot of the tools out there in the world are way too colorful for me (and full of distracting emojis).
In my scripts, I just check for unset term and/or use tput to get the sequences (which honors TERM=dumb)
one example:
col_ok=`tput bold; tput setaf 7; tput setab 2`
col_fail=`tput bold; tput setaf 7; tput setab 1`
col_end=`tput sgr0`
echo "${col_fail} ERROR: it failed ${col_end}"
so running the script gives me colorized output (xterm-256color),
but running it like this: TERM=dumb <script>
gives plain textThanks for sharing though, it's always interesting to me to get to know the workflows of other people!
khm
sudo sysctl vm.drop_caches=3Occasionally, for like a larger project with load balancers, I'll run an entire dev single VPS with a subdomain of the production and use a wildcard TLS cert.
Then I can do whatever I like to the dev and production will be fine. Depending on situation, I might set it up blue-green and shift some traffic over from production and monitor and if it's ok, I push that to production. Or for larger projects, mirror the whole stack (two instance pools) and alternate production and dev, so I get continuous monitoring of the latest changes and I can roll back to the last stable version by traffic shifting if need be.