Common issues faced with exec
ing an executable on Linux (2 mins read).
Some common issues you may face, with esoteric error messages, and how to fix them.
Common issues faced with exec
ing an executable on Linux (2 mins read).
Some common issues you may face, with esoteric error messages, and how to fix them.
It’s more than rails!
For fun I recently pimped out a ruby script that I had written for some testing with a little color and a spinner. If you have never used ANSI escape codes before I've put together a simple script that shows how easy it is. First let me say that if you are using ruby and
IDE style command line auto complete. Contribute to microsoft/inshellisense development by creating an account on GitHub.
Passing a private key as an environment variable (1 mins read).
How to convert a PEM-encoded private key in a form to be stored in an environment variable.
Small tip: a delightful bash alias that helped me today alias '$'='' lets you copy tutorials that include '$' verbatim.swyx 🌴 (@swyx)Mon, 07 Feb 2022 16:19 GMT
A tool for glamorous shell scripts 🎀. Contribute to charmbracelet/gum development by creating an account on GitHub.
When should I use env
to start a command with environment variables? (2 mins read).
When you should use the env
command to specify environment variables when executing a command on the command-line (TL;DR: always).
I've recently been doing similar with some of my utilities, albeit with an informal comparison between Ruby and Go versions, but would agree that for large, production critical scrips, this is a great way to do it
Shell scripts have been around for 50 years.
Ian Miell (@ianmiell)Sat, 20 Nov 2021 07:33 GMT
The hardest problem in computer science is escaping a quotation mark in a bash string.
Lorin Hochstein (@norootcause)Mon, 17 May 2021 15:32 +0000
Getting your .zshrc Just Right® has a very pronounced IKEA effect. It's a huge investment, but it feels so darn great 😆
Guillermo Rauch (@rauchg)Sun, 27 Dec 2020 18:49 GMT
One of the fights I keep losing at ${DAYJOB} is “don’t use short flags in shell scripts if you have long flags available; make things easier for the people who come after you” And like... I do not understand why this is controversial or why people resist it so strongly.Ryan McKern 🇵🇷 (@the_mckern)Fri, 18 Dec 2020 00:55 GMT
TIL that you can use the "DEBUG" trap to step through a bash script line by line
🔎Julia Evans🔍 (@b0rk)Sat, 03 Oct 2020 15:24 +0000
I very much recommend learning how to use a more well-structured scripting language than Bash, as languages such as Ruby have a great standard library, a huge ecosystem of other libraries, and are commonly installed across machines - this is a great look at partially replacing shell scripts with Ruby
I used to write a lot of shell scripts before realising that what I was trying to do was treat shell scripting as a "full" scripting language (I won't define here what I mean by "full").
Its not - reach for a higher level scripting language like Ruby or Python when things are getting more complicated, and allow shell scripts to glue things together, or be for quick tasks maybe a few lines long.
When you do write them, this advice is great but it's definitely worth gaining understanding of when you should and shouldn't use them.
Parsing a Unix Epoch With Bash/Ruby on the Command-Line (1 mins read).
How to convert a Unix Epoch to a human-readable date format.
This is a great article about how to be safer when writing shell scripts. I am a huge proponent of not using them where possible, and instead moving them to another scripting language (Ruby, Python, Node) which you can test, and use a shared standard library.
Adding Newlines to all Files in Git (3 mins read).
Adding newlines at the end of all Git-tracked files.
A sneaky and interesting way to trick someone into running a fork bomb, even if they know it may be one!
In every programming language, there is a linting tool that can help pick up on some common style issues. ShellCheck isn't one of those - it's so much more!
I've been using it for many years now, and since it came into my life it's honestly changed the way I use shell scripts. There have been so many pitfalls that I've avoided falling into since learning about them (and adding ShellCheck to my Vim linting setup.
This is a great read from Vidar, the ShellCheck author, about a case where it could've caught issues that caused the deletion of a production database!
Automating Promotion of Jekyll Posts from Draft to Post (2 mins read).
The handy script I've created to automate publishing a draft in Jekyll, with handy Zsh + Bash autocomplete.
My editorial workflow for blog posts (8 mins read).
Taking you through the journey I go on when writing blog posts, from ideation to publishing the post.
Viewing Git history of a file in git log
while ignoring file renames (5 mins read).
How to track changes to files in Git without pesky file renames getting in the way, using git log --follow
.
SSLError
When Running Berkshelf Behind a Proxy (2 mins read).
Getting around the pesky OpenSSL::SSL::SSLError SSLv2/v3 read server hello A
error when running Berkshelf behind a proxy.
Viewing your diff while writing your commits with git commit --verbose (3 mins read).
Making it easier to write commit messages by having the diff in your editor.
Extracting SSL/TLS Certificate Chains Using OpenSSL (1 mins read).
A quick one-liner to get you the full certificate chain in .pem
format.
You're currently viewing page 1 of 1, of 42 posts.