03 March 2024
Axyl, an OS with i3 by default
17 October 2022
A web server written in bash
I had wanted to try a web server written in bash for years, well the wish just came true with bashttpd available at https://github.com/avleen/bashttpd
It is pretty easy to use, you only need to download the script, make it executable and launch it. There are several launch options, one single connection or accepting multiple connections. At launch time a default config file is created, bashttpd.conf, you can configure several things, especially the files you want to serve.
In order to connect to the server, ie, to see the file it is serving use the address of the machine using port number 8080. For example if the server has the following ip: 10.100.120.2 open a web browser and type http://10.100.120.2:8080 and that's it.
Two important considerations here:
- Never use it on the web, it is highly dangerous and insecure. Use it at home or in a private network (Its main use is for testing stuff)
- "If anyone installs that anywhere, they might meet a gruesome end with a rusty fork" --- BasHTTPd creator, maintainer
Enjoy it
03 February 2022
Software I discovered in 2021
Last year I discovered two pieces of software that surprised me: The zsh and byobu
I already wrote a post talking about my experience with zsh here but I haven't really even mentioned byobu anywhere that I remember, except maybe on irc.
byobu is a wrapper for gnu screen or tmux, it really is something you have to try if you like to test new software. It can do many many things, and learning them all is a bit challenging at first because it is mainly managed using your keyboard's F keys and you need to learn them by heart. However you only need to know two basic keystrokes:
F2 opens a new window (similar to ctrl + a + c in screen/tmux)
F6 dettaches your session (similar to ctrl + a + d in screen/tmux)
Heed that these two keys are only the two basic commands. F3 and F4 move form one window to the other up and down. Want to learn more? I am sure you do...
Enjoy
27 January 2022
The truth about the zsh
I heard wonderful things about the zsh and the wannabe geek in me couldn't help installing it in some of my computers (including the raspi) and it might be yet too soon since I have only been able to play with it for a week or so, but I think I am ready to tell you the truth about the zsh (heed that I mean "my truth"). And bear in mind that we, wannabe-geeks, are so enthusiast that we say "play" instead of some other more appropriate, descriptive word. In the end it is all the same: Learning and having some fun.
Well, when you fire up zsh for the first time it offers you a menu. You can choose among several options, it offers to create a blank .zshrc or a default basic .zshrc according to the configuration chosen by your admin (read your distro) or configure a brand new .zshrc following some other items on the menu. Man, ain't that super cool?
I tried all the options, and my conclusion is, if you only have a basic configuration you can only do basic things, you need to add your own aliases, your own functions and this way it (apart from some enhancements on its own) behaves very similar to other shells, say bash or ksh.
When I say "basic" I mean I even had to add things like:
alias ls='ls --color'
alias grep='grep --color'
and so on and so forth. I even had to add alias la='ls -alh' Man, that sucks. I thought zsh was so clever and so cool...
But what happens when you add something like oh-my-zsh ? Man, that's a completely different world!!! That is where the true power of the shell comes to the fore. oh-my-zsh and probably other similar frameworks add dozens of super elegant themes and plugins (for git, for managing history...) many of he plugins add hundreds of aliases to your configuration.
And apart from the fact that the default theme sucks big time (which really makes you want to dive in the pool of themes looking for a better one) now I can say that zsh is really and truly awesome. Much in the same way other shells can do great things if you add them great stuff.
Themes are basically customized prompts, some of them add nice info like the timestamp of commads or simply a local clock. I like the traditional user@host (+ directory) ~$ model:
For example: chals@jean:~/bin »
Here is where one of the plugins, git, is rad. When you enter a git repo it adds the branch you are in in the prompt.
For example:
chals@jean:~/git » cd soma/
chals@jean:~/git/soma(master○) »
Conclusion: I am enjoying zsh a lot and I really like it. I will continue playing with it to see how many good things I learn in the long run. In my raspi it is now the default shell and by the way, I need to customize the web-search plugin for my raspi.
21 January 2022
pharc v.7.0 released
I am proud to announce that today I released pharc v.7.0. It only includes some minor changes as you can read in the changelog:
* pharc v.7.0
* Updating permissions for gophernicus.
The thing is, when we had bucktooth as gopher server, it was ok to have permissions 750 for directories and 640 for files. This is not the case anymore with gophernicus. It needs 755 and 644 permissions.
This is not a great deal, it was pretty easy to run these lines I found on sdf's gopher tutorial:
$ find ~/gopher/ -type f -print0 | xargs -0 chmod 644
$ find ~/gopher/ -type d -print0 | xargs -0 chmod 755
But it had to be done manually and after that you had to chmod +x your
moles again to work.
Like I said, this was not a huge problem but I had to do something about it.
So now the problem seems to be fixed for good.
One more important change is that since I had to update the wiki for version 7.
I added the wiki to the gopherhole. So from now on you can find both resources
(the source code and the wiki) on the web and on gopherspace.
On the web:
https://gitlab.com/pharc
https://gitlab.com/pharc/pharc/-/wikis/home
On gopherspace:
gopher://sdfeu.org:70/1/users/chals/downloads/software
gopher://sdfeu.org:70/0/users/chals/wiki
15 July 2020
Screenshot of the week 13
26 June 2018
Screenshot of the week 14
At the same time I had to tweak the html code a little bit as well as the the css of the site. It is not a big change, but I love how it looks like in elinks.
Note: The window manager is i3
Enjoy the screenshot of the week :)
28 July 2017
Dillo: like a bat out of hell
I love graphical browsers. My favourite ones are chromium and firefox.
I love browsers that somehow are in the middle like w3m-img or links2.
This is to say that I spend a lot of time surfing the web in different ways depending on what I need to achieve or the hardware I am using at the moment. It is not the same being connected to a powerful remote server or connected using an eeepc of 512mb of ram.
So instead of saying that I love them, it would be more accurate to say that I make an extensive use of all kinds of web browsers.
Among the graphical browsers I used to like was midori, it allowed me to do almost anything I could do with chromium but it needed less resources which was fine. The problem I have always had with midori is that I have often have to face one or other bug. In my eeepc everytime I scrolled down it opened a new tab and switched to it (oh man so annoying).
But thank god I discovered dillo. It is an incredibly fast graphical web browser that works like a charm in all my machines, especially in my less powerful ones, like the eeepc or any other old laptop/desktop machines.
Dillo has a certain number of limitations, that is true. It does not interpret javascript and therefore you lose a bit of some sites functionality. But this is a trade-off I am willing to accept.
Dillo has a number of configuration files under ~/.dillo that once tweaked will make your life way better. This is a list of the files you need to have in there:
* dillorc This is the actual config file. You can set many options here like the homepage, the colours you like...
* domainrc Dillo cross-domain request rules file. In this file you can configure which sites are allowed to retrieve data from third party domains.
* bm.txt The bookmarks file. You can add any bookmarks from the browser using its graphical interface, however the syntax is very easy and it is quicker to add your bookmarks directly to this file. For example:
:s1: Super cool sites
s1 http://www.chalsattack.com chalsattack
s1 http://blog.chalsattack.com/ chals' blog
* cookiesrc How to handle cookies. The syntax is also plain easy.
DEFAULT DENY
chalsattack.com ACCEPT
blog.chalsattack.com ACCEPT_SESSION
Note: Accepting cookies will create an additional cookies.txt file in ~/.dillo
Once everything is in place prepare to surf at full speed, be careful, you might get a ticket for speeding ;)
Now you can visit most sites on the web, check your mail and do almost anything you can do with other browsers. But you will not be able to for example watch videos or visit sites that exclusively depend on javascript.
Conclusion: The chalsattack.com version which was active from 2015 and 2016 made an extensive use of javascript, since I couldn't visit it with dillo, I re-wrote the site from scratch as you can read here
Next installment: a screenshot of dillo in action.
28 May 2017
raspi 3.5 inch touch screen
git clone https://github.com/goodtft/LCD-show.git
chmod -R 755 LCD-show
cd LCD-show/
sudo ./LCD35-show
Awesome!!!
02 February 2017
smplayer bar
Smplayer's zoom is probably one of the best damn things ever!!!
28 January 2017
pharc v.6.0 released
I used to release pharc once a year, so:
v.1.0 --> 2011
v.2.0 --> 2012
v.3.0 --> 2013
v.4.0 --> 2014
v.5.0 --> 2015
But like the wiki says:
Is pharc still actively developed?
pharc has now all the features and options I envisioned through all these years of development. From now on I only intend to make bug fixes and minor changes.
Well, this year one of the visitors said that the sorting of the archives was upside down, so I decided to change it to order archives in a more logical way.
Added to the changelog:
pharc (6.0-1)
v.6.0
Sort Archives in reverse mode.
You can read more in detail in the phlog post at: gopher://sdf-eu.org:70/1/users/chals/phlog
And get the software (all available versions) at: gopher://sdf-eu.org:70/1/users/chals/downloads/software
Have fun!
08 December 2015
gui vs cli
However, over the years and very little by little, I discovered that most cli programs are faster, more powerful and strikingly way easier to use than their gui counterparts.
I know this is easier said than done, but in order to prove that, I needed to make an exhaustive list of all the programs I use at the gui and their cli counterparts. Let me insist that this list is exclusively a list of software I use on a daily basis. It is far from being exhaustive in terms of covering all the software I install on my computers.
The first two examples that come to mind are synaptic and d4x. At first I always used synaptic to manage software and d4x to download files. After some time I started using aptitude and wget. I never looked back.
Then the music player. I started using cmus and I never installed rhythmbox again.
As torrent client I used several gui programs. Now I exclusively use rtorrent.
Of course the usual and most basic applications you use on a daily basis are your file manager and your text editor. On the gui I use pcmanfm and medit but on the cli I use the mc and nano.
On a daily basis you also need a window manager. I use i3 on the gui and very rarely dvtm on the cli, I tend to use tmux as a window manager instead of a proper window manager.
Perhaps the toughest program to get rid of is the web browser, we are so used to graphical browsers that it is sometimes hard to browse the web in a text only browser. I mostly use chromium on the gui and a wide variety of text browsers like elinks, which has tab support (with vp for images), lynx and lately, I have started using w3m more and more for its ability to display images inline.
I also ditched gitk in favour of tig, because it is more handy.
There is also a number of applications that I do not use on a daily basis, but almost always on the cli, such as scrot for my screenshots.
07 October 2015
torrents galore
One of the things that I had always wanted to do was installing a torrent client which could run unattended. I have a lot of experience with mldonkey, which is a client for several networks, bittorrent among them. However, I was looking for a lighter client for my raspberry pi. I tried several clients: rtorrent, ctorrent, and I finally settled for transmission, or more accurately transmission-cli.
Many, or most clients, have both a GUI and a CLI, some of them have a web interface which is great for managing your downloads from a remote location. But I somehow prefer logging into the machine using ssh, opening a multiplexer instance (usually screen) and fire up the bittorrent client. This is damn simple for all of us who spend most of our free time logged into remote machines, for work or play.
Using transmission-cli is easy peasy:
$ transmission cli *.torrent
Awesome!!!
Update 11-10-2015: A friend of mine suggested trying transmission-daemon and its web interface. I did. It is great, even though it needs a little tweaking since it uses a different user by default (debian-transmission) and you have to give that user write permissions to the directory you want to store your files.
Update 24-11-2015: Even though I use transmission-daemon and transmission-cli on my raspi. I exclusively use rtorrent in my laptops and servers. rtorrent is a really powerful and handy bittorrent client.
03 September 2015
dotfiles
Note: In debian, besides stow, there is a package called xstow which stands for (extended stow). They both work in a similar way.
GNU Stow is not meant to manage your dot files. The typical area of action of stow would be /usr/local Its main usage is creating links to files in differnet parts of your filesystem so that you can try different versions of the same program (or at least this is what I understood from reading this article: Using GNU Stow to manage your dotfiles).
And reading that article is precisely how I learnt to use it to create symbolic links to all my dot files while they are perfectly stored in my home in a directory named dotfiles.
The main reason why I like it so much is because Stow does something similar to what I used to do manually. The fact of finding a program that does all the hard work for you automatically is really great.
This is what I used to do before:
I had a dotfiles directory inside my Dropbox folder which synchronized across all my computers. Inside that dotfiles directory I had several files, but I'm going to use the typical .bashrc as an example.
In all my machines I made a symbolic link in my home directory named .bashrc to Dropbox/dotfiles/.bashrc This way all my computers read the same file as if the file was a real one. Make no mistake, the file did exist, but it was only a link after all.
In order to achieve this I had to type:
$ ln -s ~/Dropbox/dotfiles/.bashrc ~/.bashrc
Whenever I made a new installation, I had to do the same for each of my dot files inside my dotfiles directory.
I do not know if you can imagine it, but my dotfiles directory was a little bit chaotic because there are many dot files that have their own dot folder so there were files with a dot, folders with a dot and files inside the dot folders.
What GNU Stow does for you:
With Stow you can keep all your dot files perfectly organized inside their own directory as long as they are inside ~/dotfiles And stow will make a symbolic link to all the right places where the files should go.
For example. You would place your .bashrc inside a directory named bash inside your dotfiles directory. Then you would only have to change to your dotfiles directory and type:
$ cd ~/dotfiles
$ stow bash
And be done with it. Isn't this an extraordinary thing?
Note: keep in mind that in debian you can also use xstow instead. It works exactly the same. Thus:
$ cd ~/dotfiles
$ xstow bash
Now comes the best part of all. So far my examples have only taken a single file (.bashrc) into account. But sure your dotfiles directory is full of both dot files and dot folders. If you had to go one by one it would be as hard as making the links manually. Well, with stow you can use wildcards to make your life easier.
For example, if you have in your dotfiles directory the following directories:
bash i3 cmus filezilla elinks mr nano gitconfig tmux mc ssh screen supertux
In order to create symbolic links to them all at the same time you can do:
$ cd ~/dotfiles
$ stow *
And be happy :)
One important consideration is that in each directory inside your dotfiles directory, you have to keep the skeleton structure of your dotfiles.So that stow knows where to place them. I recommend you take a look at the article I linked to above in order to understand it better.
Another important consideration is that I created a private git repository to use a version control system to keep track of changes to my files.
02 September 2015
pharc v.5.0 released
The downloads page (Includes the raw script and the .deb package):
gopher://sdf-eu.org:70/1/users/chals/downloads
The git repo, now hosted at gitlab, since gitorious closed down:
https://gitlab.com/pharc/pharc
LINKS TO FILES:
deb package 5.0.1
raw script pharc5
And the wiki:
https://gitlab.com/pharc/pharc/wikis/home
- v.5.0
- Add '-A|--all' option to archive all years at once.
- v.4.0
- Changed shebang to #!/bin/sh to make script more portable.
- Improved if[...]else statements to make script more robust.
- Added functionality to choose year of archive.
- Added functionality to specify several years in one go.
- Added '-l|--list' option to list unarchived phlog posts.
- Logging by default to "$HOME/pharc.log"
- Split code into functions.
- Added option '-d|--delete to delete the log file.
- v.3.0
- Added option -a to specify year of archive (Redundant).
- Added -v (version information option).
- Added -h (help menu).
- Added -y (year of the archive).
- Help function (usage).
- Improve coding style.
- Leave a backup of gophermap -> gophermap~ (in case things break).
- Test before echoing "You're done now. Thanks for using pharc."
- v.2.0
- Updating for mkphlog v.0.2
- Adding version number 2.0
- Adding license (2012)
- Initial release.
10 June 2014
More dual head
When all windows are closed, the left monitor screen background remains black. For the picture, I opened weechat, cmus and htop (which are some typical applications that I use all the time. Usually, I also have the mc or pcmanfm for file management) and the right screen shows this cute picture. I really like it, in fact I like it so much that I wanted to publish it on my blog right away. I hope you like it too.
07 June 2014
pharc v.4.0 released
This year in particular, I did a lot of testing because there were many new options. And even so, I had to make a last minute change to make it work on NetBSD 6.1.2. I changed one echo call which contained a backlash escape character to printf because NetBSD's version of echo renders the backlash characters literally. So:
echo "1Archive $DIR\t$DIR" >> gophermap
Had to be re-written as:
printf "1Archive $DIR\t$DIR\n" >> gophermap
Not a big deal really, but last minute changes are sometimes annoying because you have to re-test and make sure that it remains posix compliant and that it works. Remember that I use two different platforms to test it: NetBSD + ksh and debian + bash
Below are some links that will lead you to more detailed information about pharc
The official release announcement, of course in my own phlog (which is archived by pharc):
gopher://sdf-eu.org:70/1/users/chals/phlog/./06-07-14
The downloads page (Includes the raw script and the .deb package):
gopher://sdf-eu.org:70/1/users/chals/downloads
The git repository, hosted at gitorious:
https://gitorious.org/pharc
and the wiki (important to consult, since in includes almost all possible use cases):
https://gitorious.org/pharc/pages/Home
I hope you like it and have fun with it! Happy phlogging :D
04 June 2014
Screenshot of the week 11
Here is a screenshot of my dual head desktop machine:
Note: I have not prepared the window arrangement for the screenshot. I simply opened some of the windows I use on an everyday basis, such as weechat, cmus, htop, a web browser and some terminals. (On a regular desktop environment I would have also opened a file manager, such as pcmanfm). I launched scrot to perform a test screenshot. Much to my surprise, I liked it and I said to myself, well, this is as good as any other.
Almost every tiling window manager has its own long list of features. However...
There are several things that make i3 outstanding. The first one is that it supports multiple monitors out of the box. In my case, my main desktop is a dual head, so it is really great to take advantage of so much space to fill with windows. I just need to use xrandr as I usually do for example for xfce4:
$ xrandr --output VGA-1 --left-of DVI-I-1
Secondly, the way i3 deals with workspaces is really nice. With one single monitor, there is only one initial workspace, but you can create as many workspaces as you want by simply changing into them. This is to say, if the workspace you change into does not exist it gets created at once. If you have two monitors, there will be two initial workspaces (one per monitor), but you will still be able to create new ones.
You can arrange windows in three different layouts: split, stacked or tabbed. I normally simply split them but the other two layouts are very handy to have your windows in fullscreen.
Another feature that makes i3 out of this world is that you can be productive with it from the very moment you install it. Yeah, sure there is an small learning curve until you learn all the keybindings, but you can also perform many operations with the mouse as if you were using a regular desktop environment. What is more, with just one stroke you can make the windows float and move them around with the mouse.
The fact that the window focus follows the mouse is a bit annoying, I'd rather do it with the keyboard because if you move your mouse involuntarily into a window, you might find yourself typing passwords on the irc channel. Such is life, I know... but still embarrassing :-p
But there is a configuration option for that (the config file can be found at either .i3/config or .config/i3/config)
# focus_follows_mouse <yes|no>
focus_follows_mouse no
Want more? i3 is faster than fast. In my dual head desktop, an old P4 machine, i3 loads in just 3 seconds. Yeah i3 loads in 3s. Ain't that really impressive?
Another thing I like is that you can load any applications you want at startup. You only have to use the exec command in your config file like this:
exec chromium
exec i3-sensible-terminal
exec dropbox start
exec gmail-notify
The config file is the right place to create your own keybindings. The documentation gives an example of how to use a key combination to take a screenshot. Using the example as a reference I have added a shortcut for the sound mixer:
# Open sound mixer
bindsym --release $mod+m exec alsamixergui
Imagine that you would like to have the mixer in all the workspaces. That is easy to achieve. One of the nicest features of i3 is the scratchpad. It is a window that you can have in all the workspaces by simply pressing a key. From the documentation:
# Make the currently focused window a scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the first scratchpad window
bindsym $mod+minus scratchpad show
It could also be useful for your notes, your text editor, your irc program...
Then $mod+c reloads the config file. Or alternatively $mod+Shift+r restarts i3 inplace
I could certainly go on and on. I think I will continue adding some more info as I discover new tricks. By the way, just as a curiosity. I had installed i3 a while ago but I had never really got very much into it until now. However, I remember using wmii and enjoying it. I even wrote a blog post here
At this very moment I'm reading the i3 user's guide trying to find super "kewl" things to try. I have already learnt by heart most keybindings. I especially like the $mod+f to toggle fullscreen mode. One thing that I do not understand is why the heck (on my stable machines) $mod+h splits the window vertically and $mod+v splits windows horizontally. Both the config file and the user's guide say that $mod+h should split horizontally and $mod+v should split vertically. However they work the other way round, unless I'm going out of my head and horizontal and vertical do not mean horizontal and vertical respectively ;)
Update: It seems to work correctly on my sid machine. It might have been a bug.
I have installed i3 on almost all my machines (even on my tiny eeepc 701) and of course I'm writing this post using it. I hope you like it ;)