Left a comment on the blog of the author of the tool called ag. It is an interesting tool, however it is funny to see the narcissistic passion behind with tons of text centered at presenting himself as the hero of the year. Made a friendly comment on one of the latest posts about the tool, however the reply was rather annoying and disgusting.
Here my comment:
“hi, thanks for your work on ag! Really impressive tool. Would have four suggestions:
-> one hint for speedup: did you think/try asynchronous io? Under certain conditions usync io on several files can be much faster on one thread than sync io on multiple threads (http://www.kegel.com/c10k.html…. I tried to search for random regex in /usr which is on o very fast SSD on a 8 core AMD machine. The CPU usage is 300% which means less than half of computing power is used. Strange that even with hot cache, this does not strange. I assume that on slower disks lot of time would be spent on IO. If all threads are blocked on IO, which is very likely, nobody is working.
-> doing sthg. like ag “a.*r.*b.*n.*” will do the fuzzy find. Suggestion: a flag (-y is not taken) that will automatically convert ag -y arbn to the above
-> implement a new mode, where you would internally cache the buffers, and doo interactive fuzzy find az FZF (https://github.com/junegunn/fz…
-> implement a server mode where you would cache the buffers and do like above but search for strings comming on a socket or pipe. This would be very powerful to implement plugins like FZF, but obviously you would do much more than FZF”
The reply was rather impulsive, arrogant and abusive:
“I’m sorry, but your comment is so full of misapprehensions that it would take me an entire blog post to correct them. I can only urge you to continue learning about computation and to think about problems from first principles. For example: If you want to search a gigabyte of files, and your disk can read at 100MB/sec, no trick can get your first pass (with cold caches) faster than 10 seconds. Also, look at how async I/O is implemented and examine the use-cases in which event loops outperform blocking I/O.”
Idea(l): make a uniform output of /etc config files and compare between upgrades of the system with diff.
http://augeas.net seems to be a very good candidate.
Unfortunately the “lens system” is very nice, but parsing the etc dir is very very slow.
for f in $(find /etc | sort ); do augtool ls $f; done
takes ages to complete. Augtool will not find “lenses” for all the files, but parsing a simple file takes around one second on a very good workstation.
Verdict: solution discarded.
One of the greatest added value for a rapsbery pi like low power computer would be to use it in a home router/gateway/firewall. Unfortunately none of these boards have dual LAN. You can obviously add a usb/ethernet adapter, but most of these adapters need an extra power supply which would be against the original goal: low power.
A router that has only 1/3 of the CPU power and memory costs double.
and finally found what I was looking for: http://www.conrad.de/ce/ProductDetail.html?productcode=1290219
the banan pi simple sells for less than 30 Euros. It is much more value for money than the rapsbery pi.
Posted in arm
Tagged arm, low powe, router
Surprised to discover the python programmable microcontroler https://micropython.org/. It is a bit of contradiction. You trade some more muscles and dollars into the microcontroler and you can in exchange send code to execute in form of python. As experiment is interesting, mainly the rewrite of the python virtual machine and compiler, but I am not convinced that all this would make development process much easier, for sure not for people that are enough familiar with C.
According to the website it runs on STM32F405. You can find such a board on ebay for arround 25$. It is still lot of money if you would want to make a microcontroller everywhere project.
I just do not like stackoverflow. Cannot complain, I think I hear well noises, feel smells, see shapes colors with my eyes. On stackoverflow I feel smells that I do not like. It is just an incredible and senseless market for what? for those badges? Those people must have problems with self esteem. Stack overflow is a selfesteem-machine. What annoys me the most is that often I find though interesting questions but, locked with a comment like “This is an idiot (well diplomatically more correct expression) question probably written by an idiot, thus we close it, we will not allow anybody to have his brain damaged by answering it. FULL STOP. Well, you have to have the courage to be mediator. But the badge behind you makes you feel powerful and secure. But enough from that…
Instead go and check some of the free books out there, a very lovely collection
https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md (and all md docs for other languages)
Posted in reading
Different approaches with different advantages. For hacking network protocols was mainly using wireshark and its family. Not always easy to filter what you want.
Recently had time to look into sysdig.
To see some http messages sent by some application just did
sysdig -s2000 -A -c echo_fds fd.cip=192.168.3.78
and the http conversation is nicely displayed.
The tool can do much much more than that, but like wireshark you need root or special access to read the devices providing the data.
A new tool in the clang family is taking shape, code is available at github. It started first as a set of new functions in the libclang library, but moved soon to a separate project to ease development. The tool is based on a set of libclang like functions (also part of the project) that mainly create a “C” interface to the text based dynamic AST matchers implemented in C++.
There is not too much documentation out there about dynamic ast matchers, as the functionality is relatively new. The functions are mainly doing the following
- ast matcher pattern completion
- matching ast nodes based on string describing the matchers
- calls a chain of methods on the found matcher objects
- lists available methods to be called based on a matcher string
I will write a series of articles about the details of the tool, as well as about the dynamic matchers.
Posted in ast, c++, clang