Over the last few days I've picked an hour here and there to build another entertaining small project. A zombie infection simular game.
<canvas> component for rendering.
It is fun and relaxing to watch the little pixel humans panic from seeing zombies, and how the undead slowly but inexorably infect all the population (most times, the random city layout a few times creates isolated areas).
As part of my recent quest for reading and learning a bit about economics of our world, and by recommendation of a friend who knows at least more than me about the topic, I went for a totally different read this time.
Author(s): Mary Buffet, David Clark
What to buy? At what price? Seek the highest predictable annual compounding rate of return possible with the least amount of risk; benefit from the compounding effect of retained earnings, taking care about inflation and taxes; The price you pay determines your rate of return.
Previous paragraph was a small yet very relevant fragment of advices given in the book if you want to invest in a company. There are more, but these highlights provide a good summary. Written by a Buffet family member in the late nineties, explains in plain terms the basics of Warren Buffet's thinking, some of his investing techniques and a small framework to categorize, evaluate and judge if a company is worth an investment or not.
As another example, it suggests avoiding commodity business, trying to find consumer monopolies or "toll bridges", but more than 20 years later almost everyone will agree that this is not always clear to find. For example, when Google appeared wasn't a search and advertisement monopoly (and as of 2021 is losing ground on the advertisement business to Facebook and Amazon), and even companies that become part of a duopoly or oligopoly do so via insane amounts of invested money and are not yet profitable, so at least in the technological area Warren's concepts of searching for a company "with clean financials, good earnings and that is a monopoly" feels more of a holy grail (tell that to the venture capitals all over the world!).
Sorry, diverging outside of the book itself. In general, it is an interesting read, but parts of it are clearly obsolete. The listing of 54 interesting companies is a good example, despite still being interesting to read through. The authors tend to remark once and again and again a few topics, which isn't bad but becomes a bit repetitive, but even with that there are good general concepts to learn.
In my case, I'd choose the sentence "invest in companies that make products you understand" as something you can extrapolate to other areas.
It might be just me, but all this dark theme trend, while really nice and an advancement over past attempts (I used Windows with a black theme long ago and was hard for anything other than a gaming-only computer), feels still not perfect: My Ubuntu 20.04's dark theme has an almost white notifications & calendar widget, some applications don't support it, but where I find it still inconsistent is regarding browser support; MS Edge will use the same operating system setting, and Firefox allows fine-tuning for the theme (window borders, etc.) but for the actual browsing it's a config setting of either on or off.
The property I'm talking about, as of Firefox v89 is "
ui.systemUsesDarkTheme", with integer values
1 for disabled/enabled. And you can only change it from the advanced settings, from
That this is what I desire:
If I could have one of the following regarding the last point, I'd be happy:
ui.systemUsesDarkThemevalues (enabling/disabling it whenever I want)
about:configsettings via JS scripts)
As none of those are available options right now, I did an alternative approach: creating a bash script that will run upon login (and on demand whenever I want), to automatically set the property at my Firefox profile preferences file (
prefs.js), depending on the time of the day. It is not perfect, as you have to have Firefox closed or not only won't detect the change, but will also override when closing the value you set with whatever value it had while running, but at least works for me if I set it to run when I login.
Anyway, this is the script:
PROFILE="<your-profile-folder-name-here>" HOUR=$(date +%H) DARK_MODE_SETTING=0 if [ $HOUR -gt 20 ] || [ $HOUR -lt 8 ] then DARK_MODE_SETTING=1 fi sed -i "s/user_pref(\"ui.systemUsesDarkTheme\",.*);/user_pref(\"ui.systemUsesDarkTheme\",$DARK_MODE_SETTING);/" ~/.mozilla/firefox/$PROFILE/prefs.js
Motives of course can vary, but usually when a company has significant employee turnover it is due to one of two reasons:
In both cases, I think it is a good metric for anyone interested in a company, whenever it is to join it, to invest on it, or simply to collaborate with it.
If there were some important restructuring you want to know about it. Did the company had poor management and it changed? Was it because it had to cut costs? or maybe because somebody decided to close a line of products without re-converting employees?
We live in a world where people are often seen as numbers. Even the department in charge of people is called "Human Resources", as if categorized similarly as hardware, transport and other types of resources available to the company. So it often happens that when you need to save money, usually you save some of it by reducing the amount of salaries to pay. I'm not going to dig into if that's always unfair or sometimes justified, just state a fact.
It is also really revealing if you can gather info of employee turnover, specially on the main taskforce. I'll exemplify with a tech company: do engineers, product managers and UX people leave almost every month, or is it instead considered an infrequent event the action of somebody leaving the company? do employees on average stay for many years, or is the rotation high? and if the rotation is high, is it only employees that had been for some time, or also there's a number of new hires that don't last much?
And even more revealing (IMHO at least) could be to weight the seniority of the people leaving vs the senior roles that have been at the company for long. If there's a sudden stampede of senior roles that look relevant for the company, either they are going to build something together, or something smells off. If a place has mostly "fresh" senior roles, what made all that old guard go away?
Again, this might not be bad on itself. Maybe the company was in desperate need of fresh air and change, and the new blood will bring radical new ideas and fix things up. But I think it would always be relevant to know what happened, what triggered that disruption.
It's sad how the internet (exceptions like Wikipedia or Archive.org aside) has evolved into a group of huge, closed "information warehouses". Sure most of them are "free" (we pay with our data), but we can only use it in certain, limited ways imposed to us.
Note: This is a work in progress, consider this post more like some development notes of sources and links and references that I've found interesting. I might throw away half of it, or never finish the experiment.
What do ctypes, OpenCV-python and Pillow have in common, apart from being Python libraries? In my case they form a nice pack to begin tinkering with automation in less usual scenarios... like videogames.
After finding an amazing tutorial on how to teach an AI to drive cars in GTA V with Python, I thought I could start maybe with something simpler. Like an auto-clicker for those idle & clicker videogames.
I am using Pillow because its ImageGrab module is perfect to capture screenshots (with bounding box directly, so no need to crop anything), and it's a single line of code to transform the image into an optimized NumPy array... which is also the source for many OpenCV operations.
Regarding OpenCV, I'm just learning it as I go, half by reading its tutorials and half by directly playing with things I've seen in the GTA V AI article, like changing colorspaces and canny edge detection. I am still toying with which approach is better (grayscale or HSV), but I already have a working prototype that draws edges of coins as a black & white mask, and then by reading pixel data I'm able to pinpoint them in screen.
Handling input is becoming actually the hardest part, as I want to build it for Linux (there are lots of articles on
ctypes and Windows DirectInput) and I'm not familiar with the X Window System. Thankfully the X11 library documentation contains all calls and I already have implemented querying the mouse position (XQueryPointer) and moving it to wherever I want (XWarpPointer), so I see where it detects entities better than just raw X,Y coordinates.
I am missing how to send mouse clicks, and I'd like to play with OpenCV a bit more to try to really detect items within it (right now is raw array comparisons).
I don't know if to publish the code, partly to not ease cheating on those games (which in the end you play for free) and party because excepting the input handling code, everything else are really basic operations with each library that you can find on their respective official documentation or tutorials.
In any case, here's one screenshot of a debug frame mask with edge detection. The game was running and already past the equivalent frame, but the goal is to automatically click to pick up all gold coins enemies leave upon dying: