xSlendiX's Blog

Blog about technology and other stuff.

My adevntures with PHP

Published on: Tue, 01 Sep 2020 14:06:10 GMT, Category: Programming

You may have noticed that on my website I added 2 new things: a paste service and file hosting. Those two were made in PHP. But slendi, you may ask, how did you even manage to use the hellish language that is PHP? Well, it is not as complicated as people say. To be honest, is even better than ejs! Give it a try, you won't die as some say...

I first learnt PHP from a website a few years ago just to forget everything. Now I watched a whole 1 hour video explaining the basics of it.

Sure, I might have had some issues with it the first time setting it up but everything from there is really easy to do i.e program in it.

Every blog post of mine finishes with a conclusion so, I think you should learn PHP if you are interested in making basic applications and for making websites.

Image previews in ranger with ueberzug

Published on: Sun, 26 Jul 2020 16:04:20 GMT, Category: Linux

We all like our image previews in our file managers since we know what to pick.

Ranger is a file manager for the terminal and one cool feature of it is that it has image previews, however, they are not enabled by default. So slendi, you may ask, how do you enable image previews in ranger? It is actually quite easy to do! In this post I will tell you what you need to do to enable them!

Ok, let's start by installing ueberzug. On arch-based distros you should be able to use the AUR to install it, for example, with pikaur, you do: pikaur -S python-ueberzug but you can also use pip to install it: sudo pip install ueberzug

With ueberzug installed, now you need to open the rc config file for ranger, which should be at .config/ranger/rc.conf. Search for set preview_images false and replace false with true. After that, search for set preview_images_method w3m and replace w3m with ueberzug. That's all! Now you can go an image and you will see the preview pop up on the right!

Playing YouTube videos outside of YouTube

Published on: Sun, 26 Jul 2020 16:04:13 GMT, Category: Tech

MPV has a really nice feature where it can stream video data directly from YouTube. What did I do? I decided to make a script to play YouTube videos for me.

Doing this is simple enough: mpv '<YouTube link>'. However, you can also specify a resolution using --ytdl-format: "bestvideo[ext=mp4][height<=?<res>]+bestaudio[ext=mp4]" where <res> is the desired resolution. This is a lot to type, so I implemented dmenu and some choices for resolutions: 1080, 720 and 480.

This was just a simple tip from me for you to not use the laggy browser version. I found this really useful for watching videos on older hardware. Combine it with newsboat and you have a really good alternative to browsing YouTube!