eht16
Software Developer.
Loves to write, deploy and run software.
Posts are mainly about tech stuff, sometimes about food on trains and random other things.
All of my posts and software are 100% AI free.
Software:
![]()
General:
![]()
TIL: test -s exists - an easy way to check for non-empty files in bash scripts.
Nothing new, nothing sensational but comes in quite handy sometimes when just need to know is there any content in file X.
E.g.:
if [ -s /path/to/some/file ]; then
echo "the file is not empty"
fi
Dear Geany users,
there is a little hidden gem in Geany you might or might not know about already:
it's called Send Selection To and let's you pass the currently selected text from Geany to any command that will read and process the text from its standard input stream and Geany will read the standard output of the command and replaces the selected text with this output.
The commands to use can be configured freely in Geany. And the first three configured commands can be easily executed with a keyboard shortcut.
There are countless possibilities to quickly alter the text or code you are editing in Geany, only a few ideas:
- sort lines (using
sort, as seen above) - sort lines uniquely to remove duplicates (using
sort -u) - convert camelCase to snake_case and vice versa
- pretty print JSON (using
python3 -mjson.tool) - auto format your code (e.g. using
black,indentorclang-formator any other command line formatter) - pretty print SQL statements (using
sqlformat --reindent -) - encode Base64 (using
base64 -w 0) - decode Base64 (using
base64 -d) - ... (feel free to share your custom commands as answers)
More details can be found in the documentation:
https://geany.org/manual/#sending-text-through-custom-commands
Some examples are described in detail in the wiki:
https://wiki.geany.org/config/customcmds/sort-selection
https://wiki.geany.org/howtos/format_escaped_newlines
https://wiki.geany.org/howtos/convert_camelcase
There are rumors there will be a new Geany
release in about three weeks. Stay tuned, I'm sure @GeanyIDE@social.milchreislieferei.de will tell us soon that Geany 2.1 is on its way :smile:.