diff --git a/categories/index.html b/categories/index.html deleted file mode 100644 index 241e4fc..0000000 --- a/categories/index.html +++ /dev/null @@ -1,183 +0,0 @@ - - -
- - -
-
|
-
-
|
Add this to your /etc/lightdm/lightdm.conf file:
-
-
|
-
-
|
fc
is a shell builtin to list and edit previous commands in an editor.
-In addition to editing a single line (which you can also do with C-x C-e
), it also allows you to edit and run several lines at the same time.
-You use it like this:
List previous commands
-
-
|
-
-
|
List commands with date (in zsh)
-
-
|
-
-
|
You can add the date too:
-
-
|
-
-
|
You can edit a range of commands
-
-
|
-
-
|
The range can be relative to the current position, so the previous command is equivalent to:
-
-
|
-
-
|
If you save and exit, all commands are executed as a script, and it will be added to your history.
-Source: https://shapeshed.com/unix-fc/
-Lately I’ve noticed that logging out of i3, intentionally or when i3 fails, would also kill any tmux or emacs sessions. -This is extremely annoying.
-This is caused by a new default in logind (systemd’s login) to kill user process on logoff.
-You can revert this setting in your logind.conf (/etc/systemd/logind.conf
):
-
|
-
-
|
Or only for a specific process (e.g., tmux):
-
-
|
-
-
|
Source: https://unix.stackexchange.com/questions/490267/prevent-logoff-from-killing-tmux-session
-Sometimes you just need to copy/paste a file from a server, and copying from the terminal can be a hassle. -These two services are command-line “pastebins” just one curl away:
-
-
|
-
-
|
UPM (Universidad Politécnica de Madrid) uses a propriatary VPN solution.
-The instructions for GNU/Linux on their website involve downloading a specific client (.tar.gz
) and manually running it.
-That works, but it is kind of a hassle.
-A much more convenient alternative is installing this NetworkManager plugin:
-
|
-
-
|
Now you can simply add a new VPN connection in NetworkManager and manage it as you would any other connection.
- - -From tqdm’s github repository:
--- - - -tqdm means “progress” in Arabic (taqadum, تقدّم) and an abbreviation for “I love you so much” in Spanish (te quiero demasiado).
-
Avoid HDMI flickering/intermittent blanking on RPI with a 1400x1050 VGA monitor.
-
-
|
-
-
|
tqdm is a nice way to add progress -bars in the command line or in a jupyter notebook.
- -
-
|
-
-
|
This is a quick note on proxying a local python application (e.g. flask) -to a subdirectory in Apache. This assumes that the file wsgi.py contains -a WSGI application with the name application. Hence, wsgi:application.
-
-
|
-
-
|
A simple trick. If you want to remove all the ‘.swp’ files from a git -repository, just use:
-
-
|
-
-
|
I’ve finally decided to set up a decent personal page. I have settled -for github-pages because I like the idea of keeping my site in a -repository and having someone else host and deploy it for me. The site -will be really simple, mostly static files. Thanks to Github, -Jekyll will automatically generate static pages -for my posts every time I commit anything new to this repository.
-But Jekyll can be used independently, so if I ever choose to host the -site myself, I can do it quite easily. Another thing that I liked about -this approach is that the generated html files can be used in the -future, and I will not need Jekyll to serve it. Jekyll is really simple -and most of the things are written in plain html. That means that -everything could be easily reused if I ever choose to change to another -blogging framework (e.g. pelical). But, for the time being, I like the -fact that Github takes care of the compilation as well, so I can simply -modify or add files through the web interface should I need to.
-I hadn’t played with HTML and CSS for a while now, so I also wanted to -use this site as a playground. At some point, I realised I was doing -mostly everything in plain HTML and CSS, and decided to keep it like -that for as long as possible. As of this writing, I haven’t included -any Javascript code in the page. Probably I will use some to add my -gists and -repositories, but we will see about that.
-I think the code speaks for itself, so you can check out my repository -on Github. You can clone -and deploy it easily like this:
-
-
|
-
-
|
I will keep updating this post with information about:
-A simple trick. If you want to remove all the ‘.swp’ files from a git -repository, just use:
-
-
|
-
-
|
As part of the OpeNER -hackathon -we decided to build a prototype that would allow us to compare how -different countries feel about several topics. We used the OpeNER -pipeline to get the sentiment from a set of newspaper articles we -gathered from media in several languages. Then we aggregated those -articles by category and country (using the source of the article or the -language it was written in), obtaining the “overall feeling” of each -country about each topic. Then, we used some fancy JavaScript to make -sense out of the raw information.
-It didn’t go too bad, it turns out we -won.
-Now, it was time for a face-lift. I used this opportunity to play with -new technologies and improve it:
-The result can be seen here.
-
-
|
-
-
|
Since Heroku uses python 2.7 by default, we have to tell it which -version we want, although it supports python 3.4 as well. I couldn’t -get python 3.4 working using the -deadsnakes ppa, so -I used python 3.3 instead, which works fine but is not officially -supported. Just create a file named runtime.txt in your project root, -with the python version you want to use:
-
-
|
-
-
|
Don’t forget to freeze your dependencies so Heroku can install them:
-bash pip freze > requirements.txt
There are really sophisticated and effective ways to obfuscate personal -emails so that spammers cannot easily grab yours. However, this time I -needed something really simple to hide our emails from the simplest form -of crawlers. Most of the team are in academia somehow, so in the end all -our emails are available in sites like Google Scholar. Anyway, nobody -likes getting spammed so I settled for a custom Caesar -cipher. Please, don’t use -it for any serious application if you are concerned about being spammed.
-
-
|
-
-
|
And this is the client side:
-
-
|
-
-
|
Unfortunately, this approach does not hide your email from anyone using -PhantomJS, -ZombieJS or similar. For that, other -approaches like generating a picture with the address would be -necessary. Nevertheless, it is overkill for a really simple ad-hoc -application with custom formatting and just a bunch of emails that would -easily be grabbed manually.
-To test the contact section of the site, I wanted to populate it with -fake data. Fake-Factory is an amazing -library that can generate fake data of almost any kind: emails, -association names, acronyms… It even lets you localise the results -(get Spanish names, for instance) and generate factories for certain -classes (à la Django).
-But I also wanted pictures, enter Lorem Pixel. -With its API you can generate pictures of almost any size, for different -topics (e.g. nightlife, people) and with a custom text. You can even use -an index, so it will always show the same picture.
-For instance, the picture below is served through Lorem Pixel.
- -By the way, if you only want cat pictures, take a look at -Placekitten. And for NSFW text, there’s the -Samuel L. Jackson Ipsum
- - -Developing a python module and publishing it on Github is cool, but most -of the times you want others to download and use it easily. That is the -role of PyPi, the python package repository. In this post I show you how -to publish your package in less than 10 minutes.
-If you haven’t done so yet, take a minute or two to think about this. -To publish on PyPi you need a name for your package that isn’t taken. -What’s more, a catchy and unique name will help people remember your -module and feel more inclined to at least try it.
-The package name should hint what your module does, but that’s not -always the case. That’s your call. I personally put uniqueness and -memorability over describing the functionality.
-
-
|
-
-
|
As you can see, you need to register both in the main pypi -repository and -the testing -server. The -usernames and passwords might be different, that is up to you!
-This should be the structure:
-root-dir/ # Any name you want
- setup.py
- setup.cfg
- LICENSE.txt
- README.md
- mypackage/
- __init__.py
- foo.py
- bar.py
- baz.py
-
-
|
-
-
|
The markdown README is the de facto standard in Github, but you can -also use rST (reStructuredText), the standard in the python community.
-
-
|
-
-
|
You might notice that the download_url points to a Github URL. We could -host our package anywhere, but Github is a convenient option. To create -the tarball and the zip packages, you only need to tag a tag in your -repository and push it to github:
-
-
|
-
-
|
It is advisable that you try your package on the test repository and fix -any problems first. The process is simple:
-
-
|
-
-
|
If everything went as expected, you can now install your package through -pip and browse your package’s page. For instance, check my senpy -package: https://pypi.python.org/pypi/senpy
-
-
|
-
-
|
This is a quick note on proxying a local python application (e.g. flask) -to a subdirectory in Apache. This assumes that the file wsgi.py contains -a WSGI application with the name application. Hence, wsgi:application.
-
-
|
-
-
|
Important: SCRIPT_NAME and the end of ProxyPass URL MUST BE -THE SAME. Otherwise, Gunicorn will fail miserably.
-Try it with:
-
-
|
-
-
|
This is a very simple configuration. I will try to upload one with more -options for uwsgi (in a .ini file).
-
-
|
-
-
|
Try it with:
-
-
|
-
-
|
If everything went as expected, you can wrap your command in a -supervisor config file and let it handle the server for you.
-
-
|
-
-
|
Zotero is an Open Source tool that lets you -organise your bibliography, syncing it with the cloud. Unlike other -alternatives such as Mendeley, Zotero can -upload the attachments and data to a private cloud via WebDav.
-If you use nginx as your web server, know that even though it provides -partial support for webdav, Zotero needs more than that. Hence, you will -need another webdav server, and optionally let nginx proxy to it. This -short post provides the basics to get that set-up working under -Debian/Ubuntu.
-First we need to install Apache:
-
-
|
-
-
|
Change the head of “/etc/apache2/sites-enabled/000-default” to:
-
-
|
-
-
|
Then, create a file /etc/apache2/sites-available/webdav:
-
-
|
-
-
|
Ideally, you want your webdav folders to be private, adding -authentication to them. So you need to create the webdav and zotero -users and add the passwords to an htpasswd file. Even though you could -use a single user, since you will be configuring several clients with -your credentials I encourage you to create the zotero user as well. This -way you can always change the password for zotero without affecting any -other application using webdav.
-
-
|
-
-
|
Enable the site and restart apache:
-
-
|
-
-
|
At this point everything should be working at -http://<your_host>:880/dav/zotero
-After the Apache side is working, we can use nginx as a proxy to get -cleaner URIs. In your desired site/location, add this:
-
-
|
-
-
|
Now just reload nginx:
-
-
|
-
-
|
Today’s post is half a quick note, half public shaming. In other words, -it is a reminder to be very careful with OAuth tokens and passwords.
-As part of moving to emacs, I starting using the incredibly useful -gh.el. When you first use it, the -extension saves either your password or an OAuth token in your -.gitconfig file. This is cool and convenient, unless you happen to be -publishing your .gitconfig file in a public -repo.
-So, how can you still share your gitconfig without sharing your -password/token with the rest of the world? Since Git 1.7.0, you can -include other files in your -gitconfig.
-[include]
- path = ~/.gitconfig_secret
-
And now, in your .gitconfig_secret file, you just have to add this:
-[github]
- user = balkian
- token = "< Your secret token >"
-
-
- This is a short tutorial on connecting a zigbee device (an Aqara cube) -to an MQTT server, so you can control your zigbee devices from the -network.
-If you’re anything like me, you’re probably a sucker for IoT devices. -For a long time, I’ve been using WiFi-enabled lights, and Amazon dash -buttons to control them. To keep these (cheap Chinese) internet enabled -devices away from your network and their respective cloud services, -you’ll probably want to set up a dedicated network in your router (more -on this on a future post, maybe). Another disadvantage of WiFi devices -is that they’re relatively power hungry.
-A popular alternative is using ZigBee for communication. It is a -dedicated protocol similar to bluetooth (BLE), with lower power -requirements and bitrate.
-Take the (super cute) aqara cube as an example. It is a small cube that -detects rotation on all of its axes, and tapping events. Here’s a -video:
- - - -To connect to zigbee devices you will need a zigbee enabled gateway -(a.k.a. hub), which connects to your WiFi network and your zigbee -devices. Once again, this means adding an internet-enabled device to -your home, and probably a couple of cloud services.
-As an alternative, you can set up your own zigbee gateway, and control -it to your home automation platform of choice (e.g. home assistant). We -will cover how to set up a zigbee2mqtt gateway that is also connected to -an MQTT server, so you can use MQTT to control your devices and get -notifications.
-What you need:
- -You will need to flash your sniffer. For that, you only need to follow -the instructions from the zigbee2mqtt -documentation.
-Once you’re done flashing, you’re ready to set up the zigbee2mqtt -server. For convenience, I wrote a simple docker-compose to deploy a -zigbee2mqtt server and a test mosquitto server:
-
-
|
-
-
|
You can test your installation with:
-
-
|
-
-
|
zigbee2mqtt supports the following events for the aqara cube: shake, -wakeup, fall, tap, slide, flip180, flip90, rotate_left and -rotate_right. Every event has additional information, such as the sides -involved, or the degrees turned.
-Now you are ready to set up home assistant support in zigbee2mqtt -following this -guide.
- - -Believe it or not, Surface tablets have pretty good linux support, except for the webcams in newer models. -These are some useful notes to get Ubuntu installed in your surface go, as of Summer 2019.
-
-
|
-
-
|
-
|
-
-
|
Switch out of Windows S mode.
-Boot into the “Command Prompt”.
-From Windows go to “change advanced startup options” and select “restart now”.
-When it reboots, choose the “Troubleshoot” option, then choose the “Advanced options” option, and finally choose the “Command Prompt” option.
-After the device reboots, login to the command prompt and then you should see a terminal with X:\windows\system32>
-At the prompt, check your UEFI entries:
-
-
|
-
-
|
Copy UEFI entry of “Windows Boot Manager” to create a new entry for Ubuntu: bcdedit /copy {bootmgr} /d “Ubuntu”
-Copy the printed GUID number including the braces {} using Ctrl+C
-Set file path for the new Ubuntu entry. Replace {guid} with the returned GUID of the previous command (Ctrl+V). bcdedit /set {guid} path \EFI\ubuntu\grubx64.efi
-Set Ubuntu as the first/ entry in the boot sequence. Again replace {guid} with the returned GUID of the copy command.
-
-
|
-
-
|
Check your UEFI entries again: bcdedit /enum firmware You should see something like this:
-
-
|
-
-
|
Make sure the GUID you copied is the first one listed in displayorder. Then type exit, turn off the PC and turn it back on. After this my surface go is automatically booting to the grub bootloader which lets me choose between Windows and Ubuntu but defaults to Ubuntu after ten seconds.
- -I recently got Logitech MX Keys for Mac keyboard at work. -The German version, to be more precise. -This version was three times cheaper than the Windows equivalent with either US or ES layout. -Since I touch type anyway, I thought it was a bargain.
-As soon as I plugged it in, I realized there were some glaring issues with the keyboard. -First of all, the Meta/Super and Alt keys are reversed in this keyboard. -In the normal/full version of this keyboard, Logitech gives an option to choose between Mac, Windows and iOS host, and that changes the behavior of the keys. -In this version, tho, only iOS and Mac are available.
-Besides that, there’s the issue of the grave (tilde) and angle keys switched as well.
-Switching these keys around would be very easy with Xorg, but Wayland once again complicates things…
-These issues almost made me return the keyboard. -Luckily, tho, there is another option: configuring the keys one level lower than wayland (and X11), through hwdb.
-Long story short, this will configure any Logitech keyboard with the same product id (0x4092) to use a saner configuration:
-
-
|
-
-
|
After that, simply run:
- sudo udevadm hwdb --update && sudo udevadm trigger
-
-
- tqdm is a nice way to add progress -bars in the command line or in a jupyter notebook.
- -
-
|
-
-
|
This is a quick note on proxying a local python application (e.g. flask) -to a subdirectory in Apache. This assumes that the file wsgi.py contains -a WSGI application with the name application. Hence, wsgi:application.
-
-
|
-
-
|
A simple trick. If you want to remove all the ‘.swp’ files from a git -repository, just use:
-
-
|
-
-
|
For more information, check my list of public repositories in Github.
- - -This is a quick note on proxying a local python application (e.g. flask) -to a subdirectory in Apache. This assumes that the file wsgi.py contains -a WSGI application with the name application. Hence, wsgi:application.
-
-
|
-
-
|
A simple trick. If you want to remove all the ‘.swp’ files from a git -repository, just use:
-
-
|
-
-
|
This is a quick note on proxying a local python application (e.g. flask) -to a subdirectory in Apache. This assumes that the file wsgi.py contains -a WSGI application with the name application. Hence, wsgi:application.
-
-
|
-
-
|
This is a quick note on proxying a local python application (e.g. flask) -to a subdirectory in Apache. This assumes that the file wsgi.py contains -a WSGI application with the name application. Hence, wsgi:application.
-
-
|
-
-
|
tqdm is a nice way to add progress -bars in the command line or in a jupyter notebook.
- -
-
|
-
-
|
This is a quick note on proxying a local python application (e.g. flask) -to a subdirectory in Apache. This assumes that the file wsgi.py contains -a WSGI application with the name application. Hence, wsgi:application.
-
-
|
-
-
|
This is a quick note on proxying a local python application (e.g. flask) -to a subdirectory in Apache. This assumes that the file wsgi.py contains -a WSGI application with the name application. Hence, wsgi:application.
-
-
|
-
-
|