bash-timestamping-sqlite
ShellCheck
Our great sponsors
bash-timestamping-sqlite | ShellCheck | |
---|---|---|
9 | 488 | |
31 | 34,934 | |
- | - | |
4.1 | 8.6 | |
over 2 years ago | 12 days ago | |
Haskell | ||
- | GNU General Public License v3.0 only |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
bash-timestamping-sqlite
-
Accuracy of Commercial Sleep-Trackers Compared to Research-Grade Tools
> It’s just collecting data for the sake of collecting data.
No, sleep is one of the most important parameters for health!
If in 2024 you are not collecting data on your sleep to take action (and for ex, stop overtraining, reduce drinking etc) to reduce the risks of future brain problems, you are doing it wrong.
> Even if it was accurate, I can just tell by feel
I can't, and I fear it may be the same "overconfidence" issue that cause car accidents when drunk.
I collect logs with my sqlite based bash history collection that I've been running for 5 years: https://github.com/csdvrx/bash-timestamping-sqlite
Thanks to my garmin, I have identified a pattern where I feel ok, but my garmin reported less REM sleep than usual: in the day, I run a few more commands than usual and I have more mistakes (as can be seen by the non-zero return values)
-
Which command did you run 1731 days ago?
> Should be doable with bash's PROMPT_COMMAND if you are still on bash
Already done, with a sqlite backend: https://github.com/csdvrx/bash-timestamping-sqlite
-
Introducing chroot for Android 10, designed for the Nova Air C
It will be inspired by https://github.com/csdvrx/bash-timestamping-sqlite but it will add a theme suited for eink and a proper support for shortcuts or keys like delete/backspace/control delete/control backspace etc. as I'm used to Windows shortcuts and can't do with vim if control-left doesn't jump to the left word but I have to do the traditional esc b that I don't like much :)
-
Bash 5.2
For bash users who are tempted by zsh interactive "fuzzy" completion, here's my take on it: it's directory-aware (offering different suggestions based on your history of commands in that given directory), pure bash code using sqlite to store data: https://github.com/csdvrx/bash-timestamping-sqlite
The only other dependency is fzy for fuzzy matching.
-
Everything you ever wanted to know about terminals(but were afraid to ask)
It should be a super simple feature to add to your terminal emulator: SCP works with a X,Y position. RCP just "jumps" there.
If you keep an accounting of how many lines you have displayed since then, you could alter the response to RCP by also doing the appropriate amount of scrolling: it should only take one variable, the deltaY to scroll.
If you want to test the idea, I think you could even use tmux and send commands to control the scrollback cf ahttps://superuser.com/questions/209437/how-do-i-scroll-in-tm...
I've used similar tricks with RCP/SCP but for simpler things: the only slight difficulty is the deltaY accounting, like when you are executing commands near the bottom of the screen because you must take into account that scolling will happen - but it's essentially similar to your idea.
So check https://github.com/csdvrx/bash-timestamping-sqlite/blob/main... and make sure you understand both how the __notbottom function works, and why PS0 needs an extra Esc[2a
Actually, now that I think more about your idea, it would be sweet to keep a SCP/RCP stack with multiple values, where you can push values with each SCP then pop them with RCP, say in sequence, or maybe just access the nth value with a different command that wouldn't pop them? That could be done nicely by augmenting RCP.
Also you could augment SCP with an optional flag to specify whether the terminal should scroll back upon RCP of this nth entry, and you'd have a great function that would be quite useful (ex: SCP with a jump bool when the return is non 0: you could make a shortcut to jump to the commands that have returned errors)
There's no reason to stop adding cool features to terminals: we're in a terminal renaissance!
-
WSL Question
Or if you use bash, try my own bash solution: https://github.com/csdvrx/bash-timestamping-sqlite
-
Do-nothing scripting: the key to gradual automation
> The problem happens when somebody "updates" that web server in-place.
Imagine this is 28-nginx : I would jist create another script 29-nginx-update recording the update, even if it: "echo apt-get update; apt-get upgrade nginx ; echo "make sure to fix variable $foo"
Next time I have to do that, I will integrate that into 28-nginx and remove 29-nginx-update
> eventually when someone tries the whole checklist from the beginning, they'll find it's now broken; the steps aren't working as expected.
Maybe I don't understand the issue, but my scripts or text files are simple and meant to be used in sequence. If I hack the scripts, I make sure it still works as expected - and given my natural laziness, I only ever update scripts when deploying to a new server or VM, so I get an immediate feedback if they stop working
Still, sometimes something may work as expected (ex: above, maybe $foo depends on a context?), but it only means I need to generalize the previous solution - and since the script update only happen in the context of a new deployment, everything is still fresh in my head.
To help me with that, I also use zfs snapshots at important steps, to be able to "observe" what the files looked like on the other server at a specific time. The snapshots conveniently share the same name (ex etc@28-nginx) so comparing the files to create a scripts can be easily done with diff -Nur using .zfs/snapshot/ cf https://docs.oracle.com/cd/E19253-01/819-5461/gbiqe/index.ht...
Between that + a sqlite database containing the full history of commands types (including in which directory, and their return code), I rarely have such issues
Shameless plug for that bash history in sqlite: https://github.com/csdvrx/bash-timestamping-sqlite
-
s/bash/zsh/g
> I believe that using zsh means, for the vast majority of users, using just a small subset of functionality that gives a better UX when compared to Bash.
What about adding only these functionalities you may care about?
When I tried zsh, what I liked was the history search. Like youm Everything else "wasn't as simple as I expected".
So I fixed my bash. Check https://github.com/csdvrx/bash-timestamping-sqlite :
- stores everything into a sqlite database so 2 separate terminals can access each other history on the go
- add extras details to the history like when the command started, stopped, which with return code, in which directory,
- for accessing the history, uses fzy for fuzzy finding,
- provides 2 separate history search context: either global (ctrl-t) or "this directory only" (ctrl-r), with extra goodies like excluding commands with a non-zero return error code thanks to the extra things saved
I included a few examples of the SQL queries you can run.
ShellCheck
-
Ask HN: Is there a GUI for bash shell?
ncurse, dialog, zenity[2]. i/o buffering may be an issue [3a,3b]
Assuming using same account, use history command to show past commands[0a, 0b]
'load random example' on shellcheck using own custom examples from history command.[1]
--------
[3a] : http://www.gnu.org/software/coreutils/manual/html_node/stdbu...
[3b] : http://unix.stackexchange.com/questions/25372/how-to-turn-of...
[2] : http//funprojects.blog/2021/01/25/zenity-command-line-dialogs/
[1] : http://www.shellcheck.net/
[0a] : http://www.tecmint.com/history-command-examples/
[0b] : http://www.tecmint.com/remember-linux-commands/
web based documentation: https://www.tecmint.com/linux-commands-cheat-sheet/
commands grouped by typical usage patterns : https://www.tecmint.com/essential-linux-commands/
-
DevSecOps with AWS- IaC at scale - Building your own platform - Part 1
... #************************** Terraform ************************************* ARG TERRAFORM_VERSION=1.7.3 RUN set -ex \ && curl -O https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/ RUN set -ex \ && mkdir -p $HOME/.terraform.d/plugin-cache && echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' > ~/.terraformrc #************************* Terragrunt ************************************* ARG TERRAGRUNT_VERSION=0.55.1 RUN set -ex \ && wget https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 -q \ && mv terragrunt_linux_amd64 /usr/local/bin/terragrunt \ && chmod +x /usr/local/bin/terragrunt #*********************** Terramate **************************************** ARG TERRAMATE_VERSION=0.4.5 RUN set -ex \ && wget https://github.com/mineiros-io/terramate/releases/download/v${TERRAMATE_VERSION}/terramate_${TERRAMATE_VERSION}_linux_x86_64.tar.gz \ && tar -xzf terramate_${TERRAMATE_VERSION}_linux_x86_64.tar.gz \ && mv terramate /usr/local/bin/terramate \ && chmod +x /usr/local/bin/terramate #*********************** tfsec ******************************************** ARG TFSEC_VERSION=1.28.5 RUN set -ex \ && wget https://github.com/aquasecurity/tfsec/releases/download/v${TFSEC_VERSION}/tfsec-linux-amd64 \ && mv tfsec-linux-amd64 /usr/local/bin/tfsec \ && chmod +x /usr/local/bin/tfsec \ && terragrunt --version #**********************Terraform docs ************************************ ARG TERRRAFORM_DOCS_VERSION=0.17.0 RUN set -ex \ && curl -sSLo ./terraform-docs.tar.gz https://terraform-docs.io/dl/v${TERRRAFORM_DOCS_VERSION}/terraform-docs-v${TERRRAFORM_DOCS_VERSION}-$(uname)-amd64.tar.gz \ && tar -xzf terraform-docs.tar.gz \ && chmod +x terraform-docs \ && mv terraform-docs /usr/local/bin/terraform-docs #********************* ShellCheck ***************************************** ARG SHELLCHECK_VERSION="stable" RUN set -ex \ && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION?}/shellcheck-${SHELLCHECK_VERSION?}.linux.x86_64.tar.xz" | tar -xJv \ && cp "shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/bin/ \ && shellcheck --version ...
-
Ask HN: Popular open source tool originally written in Haskell?
ShellCheck: https://github.com/koalaman/shellcheck
-
Google ZX – A tool for writing better scripts
If I want to write better shell scripts I usually run shellcheck and adjust accordingly or if I need facilities not provided by the shell i switch to a full fledged programming language. Ans oh yes, `sh` is present almost on every BSD and Linux box for free so I consider it an important thing to at least be comfortable with.
shellcheck: https://www.shellcheck.net/
-
How I use Nix in my Elm projects
When I run nix-shell at the root of the project it puts me in a Nix shell that contains, among other programs, caddy and shellcheck. Notice that in the shellHook I add the project's shell scripts to the PATH. So once I'm in the Nix shell I can, among other things:
- Ask HN: A Bash guide for Posix programmers?
-
Regex support to list modules in .cabal?
I have also seen some projects on github like ShellCheck which first make a library, expose all the modules and then simple add that do build-depends of the final executable. Is this the recommended approach than having just one executable and adding all the modules to other-modules:?
-
Shellcheck finds bugs in your shell scripts
The error checks can be pretty arcane:
https://github.com/koalaman/shellcheck/wiki/Checks
-
Is there a syntax checker?
Similar to for instance shellcheck to check the syntax of shell scripts, is there an equivalent for the set of roff commands typically used in a (Linux) man page? I'm aware that e.g. pandoc permits the conversion of an other format (e.g., org) to both roff man and roff ms.
- Shellcheck – finds bugs in your shell scripts
What are some alternatives?
shfmt - Dockernized shfmt. This formats shell script.
bash-language-server - A language server for Bash
fish-shell - The user-friendly command line shell.
fzf-tab - Replace zsh's default completion selection menu with fzf!
shellharden - The corrective bash syntax highlighter
bashcpp - Experimental fork of GNU bash, converted from K&R C to C++. Current status: build is broken due to major refactoring.
shfmt - A shell formatter (sh/bash/mksh)
zplug - :hibiscus: A next-generation plugin manager for zsh
PowerShell - PowerShell for every system!
zgenom - A lightweight and fast plugin manager for ZSH
efm-langserver - General purpose Language Server