DONE Hello world (again) general@category1
A new try with a different css…
DONE Janet? Janet! janetgame-of-lifecode@category1
Do you like C but changed because you were tired of the low productivity, the annoying syntax and - oh my god! - Segmentation fault? Holy shit! Me too!
Come on… google it…
What have I done with it?
Well, I have this pet project that it is to create a Janet wrapper for ncurses. But that will deserve a post on its own. For now, I will show a game of life using the prototype version of the janet-ncurses.
- I created a repo for it: https://git.sr.ht/~lucasemmoreira/game-of-life
- It is very simple to use it. The big bang file is the initial state of it. Play with it!
- Now you can run with janet, if you have installed it,
DONE New year, new goals, more posting! lifehabitsblog@category1
A new year has come and hopefully it won’t be 2020 too again (although it is).
My plan is to post more often from now on, hence the monero qr code =]
DONE Moving averages beatifully janetcodemath@category1
So this is another post on the janet journey. My goal here was to create a simple moving average function in janet (maybe just as a functional programming lover).
I created a repo named numja that I intend to put all mathy stuff there. And moving average fits that category.
The second step was to create a small script that would run with the new “lib”.
Simple as the proposition is, simple the code and simple the result. I used the “lib”, and plotted with gnuplot and voila!
DONE Web view in mutt muttconfig@category1
I know for a fact that you, hypothetical reader, are a mutt user. And as such, you know how frustrating html emails can be. Recently I was having this particular problem to see Jira emails.
Behold the solution!
In the mailcap file:
text/html; w3m -v -F -T text/html -dump %s; copiousoutput
DONE Pomodoro with shell script codeshell-scriptlife@category1
By now, you must be asking yourself: “Oh my god, all you know is janet/functional programming?!”, to which my answer would be a resounding “Yes!”.
However, today I decided to step a little bit outside my comfort zone and make a little script to help me use pomodoro for productivity.
Like you, hypothetical reader, I use dwm with dmenu. With these you can easily create a pomodoro executable to work for you. I say easily because I have no experience with shell script and I made it happen.
DONE You don’t need browser to check if a website is up!
However, there is not another one made in janet, authored by me, made in the last month! I can guarantee it!
Well, my goal here was to make a simple software that did one thing and well. That one thing is to check multiple urls if they are up and the status they would return.
This is another one in the janet journey. I used a ncurses wrapper to create the tui. All you need is a url file with a name reference and the respective url to be checked. With just this, you are ready to use it.
What does it look like?
DONE Artix vs NVIDIA linuxnvidiasolution@category1
Today, when I turned my computer on to log in,
X complained that could not connect…
Why did that happen?
On friday, I tried to solve a glitching issue on brave, and I found online that someone solved by changing some settings on the nvidia. This genius that speaks to you, hypothetical reader, tried to download nvidia-settings to find out that the solution was elsewhere. All I had to do was to disable hardware accelaration on
Well, to the debugging process.
Two things were off:
- the card was not being loaded, meaning that all the letters were huge and the screen was most definetly not optimized
- the message given when trying to load
Number of screens does not match number of detected devices. And two devices were shown:
After I recovered from a panick attack, I summoned my mate Umgeher for some help.
He helped me find that nvidia blacklisted my graphic driver nouveau. From this link I could figure out what file to remove to take nouveau out from the blacklist. Now, reboot!
After that, the screen went back to the regular resolution, however the
X still did not connect. But something different from the previous situation is that an
xorg.conf was created at
/etc/X11/. From there all I had to do was to change the conf file on device from
modesetting (that was the other device from the list)
DONE A first (not bad) emacs experience emacsconfig@category1
Well, not for me. I have been using emacs for almost a decade now and I have used bad configs and good ones. In the past few years that I am feeling more comfortable with lisp, I have been enjoying to tweak the configuration more and more.
My girlfriend has recently come to the good side of workplace and could drop Windows and its tools. In this new world, she tried to go into the Linux and emacs was something that I was more than eager to show her!
Well, emacs has quite of an interesting learning curve source
and I totally agree with it! So I created what it could be a first step to use it.
What is FirstEmacs?
What I looked for was a way to drop the two most troublesome keys in emacs (in my opinion) and its consequences. Which are
Ctrl+v for cutting, copying and pasting. And emacs has most of its hotkeys attached to
It took me some time, but then I found wakib-keys. Which was pretty much the solution I was looking for. Basically, remaps the standart
Writing this assured the usefulness in the notation
Ctrl-x (and so on) =].
DONE Divide and Conquer to optimality! optimizationalgorithmmipcode@category1
This week I made a pretty cool achievement for the paper on the wall that says that I am an applied mathematician. This week, I developed a branch and bound to solve a mixed integer linear problem.
Well, hipothetical reader, if you asked me that, I would say that you are not familiar with the power of integer programming. This kind of technique is pretty useful in the industry, in an area called operational research.
To make it simple, it is intended to help the user make better decisions. In other words, it is inside the prescription area inside artificial intelligence (more on this later!).
Ok… tell me more… (I think)
Let’s think of an example. Let’s say you have to find the best route from point A to point B, and for the sake of the example, you do not want google to track you down, so you cannot use google.maps =].
In this case, integer programming can help you! Why? Because you have to make the decisions of where to turn and when.
Ok, the problem passed the first test. The second test is a lot more techinical. You have to be able to model this problem only with linear equations. Putting aside what is the modelling per se, you might be wondering: “Why must it be linear? Nothing in the world follows a linear curve!”. To which my answer would be: “Correct, hypothetical reader! But you gain something pretty cool by forcing it to be linear. The solution you find is guaranteed to be optimal! In the worst case, I can tell you how better the solution could be, if not optimal!”
And now, I will give you some time to think about this. I am telling you there is an algorithm that with few conditions (one might be hard one), you can have the best kind o quality measure one can think of. The final solution is
n percent worse than the best one.
Ok… I’m kind of sold. But what does Branch and Bound have to do with this?
Well, branch and bound is the go to algorithm framework solvers use to find this measure of quality I mentioned earlier. And I made one in clojure! I had to solve a small problem and I could not find a decent package similar to pulp in python (which is very sad, if I may say so).
Nice, but I don’t need to find a route…
Glad you mentioned this! That’s the beauty of it. Branch and Bound is a framework in which, if you can mathematically model the problem, you can solve a bunch of kind of problems:
- Find the best location to build a station (fire fighters, restaurants, telecomunication towers, etc…)
- Find the best way to load a truck (or any container for this matter).
- Best way to plan your production
and others. Here you can find a bunch of applications! =]
DONE Going Hugo for framework! blog@category1
But things changed when I wanted to make a second website.
org-static-blog is pretty neat to work inside emacs, however to use on a second project there is a lot of setup to do. Facing that problem and knowing about
Hugo and ox-hugo, it was a no brainer.
Now, the final equation is:
(= "<3" (+ 'ox-hugo 'hugo 'emacs))
The other project
The other website I mentioned earlier is this one. Maybe I will post some insights I had while doing this (and a proper marketing for it hehe).
DONE Managing dependencies in clojure clojureleincode
Today I was having a hard time to load a nice lib for managing excel files (https://github.com/mjul/docjure). I was having some weird problems at loading them in cider (btw, if you don’t use it, start now!).
I gave some search into it, and lein has a nice feature to handle dependencies. The command that saved me this time was:
lein deps :tree
It gave me a quick report on what was strange with the dependencies. Some examples:
1Possibly confusing dependencies found: 2[metosin/compojure-api "2.0.0-alpha30"] -> [com.fasterxml.jackson.datatype/jackson-datatype-joda "2.9.8"] -> [joda-time "2.7"] 3 overrides 4[midje "1.9.9"] -> [clj-time "0.15.1" :exclusions [org.clojure/clojure]] -> [joda-time "2.10"] 5 6Consider using these exclusions: 7[midje "1.9.9" :exclusions [joda-time]]
Possibly confusing dependencies found: [metosin/compojure-api "2.0.0-alpha30"] -> [com.fasterxml.jackson.datatype/jackson-datatype-joda "2.9.8"] -> [joda-time "2.7"] overrides [midje "1.9.9"] -> [clj-time "0.15.1" :exclusions [org.clojure/clojure]] -> [joda-time "2.10"] Consider using these exclusions: [midje "1.9.9" :exclusions [joda-time]]
DONE Patching your way to contribution! gitversion
Hypothetical reader, I know what you are thinking. You have some interesting projects, but I am not sure to engage on those because on source hut there is no way to make a pull request (at least, I have never found to the day of this writing).
Well, this make a nice oportunity to learn about
patch in git! So, the magical command I use
git format-patch -x
x is the number of commits that I did or
git format-patch branch-name
branch-name is what you expect =] (source).
A nice recommendation by Umgeher is as follows. It will give some information per line, like who wrote the commit or put the tag, for instance. To do so, make a little tweak on
[sendemail] annotate = yes [tag] forceSignAnnotated = true
DONE Remap your keyboard! config
Why? Well, because as an emacs user, you are probably tired of your pinky trip to do in order to the “chords”.
I would assume, hypothetical reader, that you have already tried changing caps for ctrl. Well that’s nice, however, let me introduce you the better idea (giving credit where is due, thanks for this Umgeher!).
It is a lot more comfortable and an easier transition to change
caps->shift. The muscle memory for shift stays the same and ctrl is in a much more comfortable position. Here is
xmodmap script to arrange that:
! making shift ctrl and caps shift remove Lock = Caps_Lock remove Shift = Shift_L remove Control = Control_L keysym Caps_Lock = Shift_L keysym Shift_L = Control_L keysym Control_L = Control_L add Lock = Caps_Lock add Shift = Shift_L add Control = Control_L
DONE All praise stash git
Today I figured a pretty cool git command. Up to this day, sometimes I get a bit disorganized with the branches, and
git stash came to save the day (or at least some working stamina).
Here is the procedure:
“Oh no! I forgot to change the branch before making changes”
git stash save "name of the mistake"
Now, moving to the correct branch
git checkout the-correct-branch
Recover the modifications
git stash pop
And, a nice command:
git stash list
DONE Searching for packages in openbsd openbsd
Finally! I am using openbsd! It is quite interesting but somethings are different. I will need to post somethings to help me remember =] Starting by package search:
pkg_info -aPqQ package | sort
where package is what you are looking for.