Programming Leftovers
Shell/Bash/Zsh/Ksh
-
Different Examples of Checking Whether a Sting Contains a Substring or Not
Sometimes, it requires checking whether a particular string exists in another string or not for programming purposes. Since there is no built-in function in Bash to do this task like other programming languages, there are some commands and operators in Bash to do this task. Different ways of checking if a string contains a substring in Bash are shown in this tutorial.
Python
-
The Whole Thing In Python
[hsgw] built a macropad in Python, and that’s not a strange language to choose to program the firmware in these days. But that’s just the tip of the iceberg. The whole process — from schematic capture, through routing and generating the PCB, and even extending to making the case — was done programmatically, in Python.
-
Classifying Python virtual environment workflows
I have been spending some time as of late thinking, and asking the community via the fediverse, about how people deal with virtual environments in Python. I have ended up with various ways of classifying people's virtual environment management and I wanted to write it all down to both not forget and to explain to all the nice people answering my various polls on the topic why I was asking those questions.
-
[Old] Beets: Chromaprint/Acoustid Plugin
Acoustic fingerprinting is a technique for identifying songs from the way they “sound” rather from their existing metadata. That means that beets’ autotagger can theoretically use fingerprinting to tag files that don’t have any ID3 information at all (or have completely incorrect data). This plugin uses an open-source fingerprinting technology called Chromaprint and its associated Web service, called Acoustid.
Turning on fingerprinting can increase the accuracy of the autotagger—especially on files with very poor metadata—but it comes at a cost. First, it can be trickier to set up than beets itself (you need to set up the native fingerprinting library, whereas all of the beets core is written in pure Python). Also, fingerprinting takes significantly more CPU and memory than ordinary tagging—which means that imports will go substantially slower.
If you’re willing to pay the performance cost for fingerprinting, read on!
-
For Developers
This section contains information for developers. Read on if you’re interested in hacking beets itself or creating plugins for it.
See also the documentation for MediaFile, the library used by beets to read and write metadata tags in media files.
Misc.
-
Responsible Disclosure: XSS in Codeberg Pages
Now, whenever I see something from the request echoed into the page's source, my hacker-sense starts tingling. What happens if I shove an innocent HTML element into the URl?
-
A New ML Stack
What stayed the same? The developer tools and libraries — TensorFlow, PyTorch. Although even these have started to be consolidated into bigger building blocks (e.g., HuggingFace’s transformers library). Generally, these libraries have absorbed new developments fairly easily, and the primitives that they provide (abstracting the underlying hardware, matrix multiplication, etc.) are generic enough.
-
The computer scientist who hunts for costly bugs in [cryptocurrency] code
-
Announcing highlight.js, an extension to highlight text on web pages | James' Coffee Blog
I participated in IndieWeb Create Day, an online event during which people in the IndieWeb come together to work on personal projects, this Boxing Day. I decided to start on a new project. I wanted to build a tool that would let me highlight specific pieces of text on my website and send those highlights to someone else for them. I have previously built a tool, fragmention.js, that lets you link to a specific paragraph of text, but this tool has its limitations: I can't link to multiple parts of a web page, I can only link to full paragraphs.
-
Running Around: 2022 running dataviz in R - quantixed
2022 was my best year for running to date. In 2021, my goal was to run 2021 km. For 2022, I wanted to see if I could run 2500 km and also to run 50 HM-or-more distance runs. I managed both and ended the year on a total of 2734 km. I also bagged two PBs for half marathon.
Of course, if you subscribe to Strava or VeloViewer or whatever, you can get a nice data visualisation of your year in running. But where’s the fun in that when we can do that (and so much more) in R?