regex – Request for help to speed up batch program for 17,000 TXT files

I have over 17,000 pages that have been scanned (for a local history archive) which I have OCRed using Tesseract to individual TXT files. I want to be able to search/locate every page containing a search word of more than 3, lower case letters. So for each TXT file I need to:

Delete all rubbish from the OCR text i.e. non-alphanumeric characters - jrepl "(^a-zA-Z0-9s)" "" /x /f %%G /O -
Remove 1, 2 and 3 letter words - jrepl "bw{1,3}b" "" /x /f %%G /O -
Change all characters to lower case - jrepl "(w)" "$1.toLowerCase()" /i /j /x /f %%G /O -
To be able to sort the remaining words they need to be on separate new lines - jrepl "s" "n" /x /f %%G /O -
Finally sort all unique words into alphabetic order and create the modified TXT file - sort /UNIQUE %%G /O %%G

I have a batch file that does the above using JREPL but it is very slow. It has been running for over 100 HOURS and I’m not even half way. Any suggestions so as to speed up the processing? I am running Windows 10. Thanks.
This is the Batch file I am running:-

Setlocal EnableDelayedExpansion
for %%G in (*.txt) do (
set old=%%G
echo !old!
@echo on

rem remove non-alphanumeric
call jrepl “(^a-zA-Z0-9s)” “” /x /f %%G /O –

rem remove 1, 2 and 3 letter words
call jrepl “bw{1,3}b” “” /x /f %%G /O –

rem all to lowercase
call jrepl “(w)” “$1.toLowerCase()” /i /j /x /f %%G /O –

rem replace spaces with new lines
call jrepl “s” “n” /x /f %%G /O –

rem reduce to unique words
sort /UNIQUE %%G /O %%G


Desktop application does not run my program, while running it on the command line works

I usually run my game using the following command:

/path/to/proton /path/to/game.exe

I created the following desktop app:

[Desktop Entry]
Exec=/path/to/proton /path/to/game.exe

But nothing happens when I launch this app. How is it possible?

HI Iam looking for a program that analyzes the bitcoin

Analyze – to study something in a systematic and careful way (Cambridge Academic Content Dictionary).

So you want for some tool that can study somethings for you in a systematic way, and it is all about the blockchain?

I think, that analyze something is to understand what really you want to extract from and see. But universal analyzer is the school task or the work task (maybe) for those who don’t care about what they want to have or do.

If you want the tool that can extract all information from the blockchain of Bitcoin, you can try my parser here. This small and simple script can produce the human readable view of raw blockchain database. So then you can analyze it by your way as you want.

Good luck!

How can I make a raspberry pi send info about a button to a c++ program?

I’m trying to connect my rasberry pi 3 b+ send if a button is pressed or not and make the program perform an action depending on the button state. Can you tell me how can i do it? Thanks in advance.

python – What’s the best way to build a Flask API to control and show the status of a program tool I have built?

I’ve developed a backend project using Python. It collects data from different sources, process the data and then perform actions with it (for example, store relevant info in a database). To execute it, I just do “python” and it starts the daemon process.

Now I want to add a Flask API in order to interact with this collector: start/stop the collection, see the state of each component, add/remove components… What is the best approach to do it? I can’t just add Flask app object and routes to the same project, because when I deploy the Api using gunicorn with several workers it runs several instances of the collector.

For example: I have in the collector a object called “GlobalManager” that is in charge of creating, deleting, starting and stoping the collector’s components. Obviously, there is only one instance of this GlobalManager, so I can’t include it in a project with Flask, because if I run it with Gunicorn, it starts several instances of the GlobalManager.

Should I code the API in a separate project and the communicate both the API and the collector through some tool?

affiliate program

Which affiliate program have you decided to participate in?

Python3 fails to launch program on 20.04.1

Both python3 and Ubuntu 20.04.1 were loaded into a new computer less than a week ago. Having loaded all listed dependencies and followed the FlatCAM 8.994 instructions The launch instruction {Python3} fails to launch. Error code indicates cannot be found.
Help is much needed and thanks in advance

coq – How do program types such as natural numbers figure into the Curry-Howard Isomorphism?

In Coq, the nat, the type of natural numbers, has type Set. By the Curry-Howard Isomorphism, all propositions of type Prop are types of corresponding proof terms. How do nats or other instances of Set figure into this isomorphism?

In other words, is there a correspondent for Sets in the Curry-Howard isomorphism, as there is for Props and proof terms, or are they outside the things that have correspondents in the Curry-Howard Isomorphism?

Sorry for the imprecise wording, I’m struggling to express my question clearly, probably because of a poor understanding of the Curry-Howard Isomorphism, happy to be corrected on any misunderstandings I have expressed above.

design – When components of an event-driven program require specific responses to specific events, is event-driven still the correct approach?

I’m working on a multi-threaded program that interfaces with external USB/serial devices via user-space device drivers.

Early in the design stage, I made the decision to split the program into three components: A, B and C.

  • Component A would possess full responsibility of communication with external devices (this is where the user-space device drivers would run). It would run on a dedicated thread.
  • Component B would serve an API off of a TCP/IP socket to third-party clients that needed access to the external devices. This component would also run on a dedicated thread.
  • Component C would provide a GUI for the user, allowing them to view and manipulate data from the external devices. Again, this would be on a dedicated thread.

So components B and C both require access to the external devices, which component A would provide.

I needed a way for the three components to interface with each other, and at the time I thought making the program event-driven would be appropriate. With this approach, components would emit an event and other components would handle those events. I always knew that some events would require responses, in the form of subsequent events. For example, if component C wanted to pull some data from the external device, to present to the user in the GUI, it would emit an event to request the data from component A, and component A would handle that event, and return the requested data in a subsequent event, which component C would be waiting for.

Since defining the above approach, I’ve realised that, in some cases, a component may require a specific response to a specific event. So building off of the example above, if component C and component B requested different data from component A, component C should be able to wait for the correct response event (that is, the response to the event emitted by component C).

So I’m considering implementing the ability for a component to wait for an event that is a direct response to the previously emitted event. I would do this via event IDs, where each event would carry an ID, and an optional response ID. The response ID would be the ID of the event that the current event is in response to.

But I feel like I’m on the wrong path. Is this really an appropriate use of event-driven design? Is it OK for events to serve as requests for data, and subsequent events as responses? Would you do it differently? If so, how?


I’ve just come across this video by Mark Richards, which seems to describe my approach with event IDs and response IDs (which he calls “correlation IDs”). So maybe I’m not on the wrong path – he seems to think using events for request/response is fine. Would still appreciate your thoughts.

linux – xbindkeys claims there is a conflict with another program, and it cannot grab all the defined keys

I installed xbindkeys to catch my custom key shortcuts, and xte in order to emulate the key presses i want to execute. This does work, but with a lot of issues.

I have to press my key combination very many times in order to get it to work once in a while, the success rate on that being about 15% or so. So as recommended by the archwiki, i ran xbindkeys -n to see if any errors are encountered, which gave me the following output:

*** Warning ***
Please verify that there is not another program running
which captures one of the keys captured by xbindkeys.
It seems that there is a conflict, and xbindkeys can’t
grab all the keys defined in its configuration file.

To my knowledge, i haven’t installed any software that should conflict with catching pressed keys (at least not on purpose). I am running Xubuntu 20.40, and i don’t know if any such software comes with it…

How would i check to see what is causing the conflict, and then go about resolving it?