I wrote a script a while ago that extends the functionality of dmenu_run by allowing me to include custom commands and dynamically generated entries from executable scripts. First of all what is dmenu? Dmenu expects newline-separated items on stdin, shows these items on the top of the screen (configurable) where you can search for the items, then and outputs the selected item to stdout. It's so…
I had a misconfiguration in my nginx deployed with ansible. I couldn't remember what was the correct configuration. I had to restore the /etc/nginx/sites-enabled directory from the backup. Fortunately or unfortunately I don't need to do this often, so I had to look up how to do it.
The vim.lsp.buf.execute_command is used to execute a command on the LSP server for a specific buffer. Neovim will deprecate (see :checkhealt vim.deprecated ) vim.lsp.buf.execute_command in favor of clint:exec_cmd in the future. For example to the typescript organizeImport should be changed from: local function on_ts_ls_attach(client, bufnr) vim.keymap.set("n", "<leader>o", "<cmd>lua…
Some help how to define arguments for a zsh completion #compdef the_command #autoload # basic subcommands, like docker run local -a _1st_arguments _1st_arguments=( 'run' 'exec' 'rm' ) # function to parse the subcommands _the_command_subcommand() { case "$words[1]" in 'run') _alternative "the_command_run:the_command run:" return ;; 'exec') _arguments "(-t)-t[some description]" return ;; esac }…
$ man grep --exclude=GLOB Skip any command-line file with a name suffix that matches the pattern GLOB, using wildcard matching; a name suffix is either the whole name, or a trailing part that starts with a non-slash character immediately after a slash (/) in the name. When searching recursively, skip any subfile whose base name matches GLOB; the base name is the part after the last slash. A…
Take the number and take the number - 1, perform a binary and ( & ) operation on the two numbers. If the result is 0 then the number is the power of 2. number != 0 && (number & (number - 1)) == 0 Let's see some numbers which are power of 2 and their binary representation (padded with 0 for easer reading): 2 00010 4 00100 8 01000 16 10000 Let's see the numbers - 1 and their binary representation…
Today I learned how to query if an address is on an rbl list. Reverse the octets of the IP address: 1.2.3.4 becomes 4.3.2.1 Then append the domain name given by the DNSBL service ( dnsbl.example.com ) Then look up of this domain's A record. host 4.3.2.1.dnsbl.example.com If the IP is listed, it will return an address, or it will return an NXDOMAIN if the IP is not listed. The exact meaning of the…
I built a simple program to share sensitive data securely In the last few months I've been working on a service, which helps to share data securely. The service called sekret.link . I wanted to practice Golang and Angular and it was a good candidate for that. Imagine that a new colleague joined to the company, there are bunch of things she will need to have access, like WiFi, database, internal…
FiiO K1 became very silent recently when you plug it in on Ubuntu for some reason. To fix it add an UDEV rule: /etc/udev/rules.d/71-fiio-k1.rules SUBSYSTEMS=="usb", ACTION=="add|change", ATTRS{manufacturer}=="FiiO", ATTRS{product}=="FiiO USB DAC K1", RUN+="/home/ajnasz/bin/init-fiio-k1.sh" And create the shelscript which set the volume whenever you plug the DAC: /home/ajnasz/bin/init-fiio-k1.sh…