Introduction to curl

This is just a barely memo about very, very basics of curl. Since curl fetches URLs and data from some endpoints, it can be used for a variety of reasons. I am using to for a very basic (and quick!) API calls tests.

If you’re on Linux, Unix or any of its clones or if you’re on Mac then you most likely have curl. If you’re on Windows, but you’re using Git for Windows (or some similar tool) then you have curl.

So, let’s jump into that basics. Be warned — you will not find here anything that you wouldn’t already knew.

Read More “Introduction to curl”

Developing applications for Raspberry Pi or Linux

Depending on: project’s scope, business expectations, your knowledge and Raspberry Pi’s role you can develop software for RPi in mainly three ways:

  1. Turn Raspberry Pi into API-like webserver with node.js and do all the programming in clients.
  2. Develop a HTML/CSS/JS application
  3. Develop an native Raspberry Pi app

All of the above require you to:

  • Develop a regular Linux app
  • Optimised to use hardware and computing power of Raspberry Pi
  • Run it in Raspbian OS or any other Linux distribution of your choice

And, if you really want to get your hands dirty and truly have no limits then you must forget about Linux and start thinking about Ultibo (there’s a separate article for that).

Developing in Ultibo (or similar complete embedded development environment) requires a lot of expertise, development knowledge and practice. And simply isn’t an option for all. Especially, if you only need to build a quick-and-easy app for RapberryPi. For these purposes this article lists details about RPi development.

Read More “Developing applications for Raspberry Pi or Linux”

Pluralized and non-pluralized rules for the same REST controller

The quickest way of adding REST support to your Yii 2 application is to add REST controller to it and configure REST rules. Just a couple of line and framework will do all the dirty stuff for you “behind the scene”.

If you do this then your REST rules will have pluralize property set to true be default meaning that even though you are using controller’s name in singular (i.e. UserController, PostController etc.) your REST URL rules will have it in plural, i.e. GET /posts/12, DELETE /posts/13 etc.

Since I am a purification and perfection maniac, I wasn’t pretty much satisfied with the idea that:

  • I have plural routes when fetching, deleting or updating single record (when pluralize = true) or
  • I have single GET /post router when fetching all records (when pluralize = false)

In other words, I wanted a solution that will give me:

  • Everything in singular (i.e. GET /post/12, PATCH /post/77)
  • Except listing all the records, where I will have plural (i.e. GET /posts)

The solution turned out to be quite simple…

Read More “Pluralized and non-pluralized rules for the same REST controller”

The smallest Linux for Raspberry Pi?

There are dozens of articles similar to this, so I treat it just as another quick memo for myself:

  1. You can create custom Linux-based system yourself with tools like:
  2. A ready out-of-the box solution is Core Linux / pi Core:
    • some info: here, here and here
    • very modular, add whatever you need
    • smallest version is claimed to have only 10 MB with GUI!
  3. Smallest Rasbian OS is 0.5+ GB in size so is out of option.

And if anything above is not for you then maybe a… non-Linux solution for your RPi?

Ultra-fast animated screen capture with LICEcap or ScreenToGif

Up until now I was using fabulous ScreenToGif to quickly capture animated screenshots for bug reporting. It truly is — as its homepage says — free, compact and powerful. It comes with handy installer, but also with portable version. And capturing is ultra-easy with it.

Today I discovered LICECap and immediately felt in love again…

Read More “Ultra-fast animated screen capture with LICEcap or ScreenToGif”

Developing for Raspberry Pi with Ultibo

Building apps that will be run on Raspberry Pi will require you in most scenarios to:

  • Develop a regular Linux app
  • Optimised to use hardware and computing power of Raspberry Pi
  • Run it in Raspbian OS or any other Linux distribution of your choice

If you:

  • Can’t or don’t want to base your solution on Linux
  • Need to have nearly no limits and full fexibility
  • Want to learn something really cool

Then you need to get your hands dirty, forget about Linux and start thinking about Ultibo.

Read More “Developing for Raspberry Pi with Ultibo”

Raspberry Pi-based computer for 80 USD or less?

The variety of original Raspberry Pi editions and thousands of its clones may be a little bit overwhelming.

If you have a problem selecting proper gear box for your scenario or solution this article may help a little bit. I’ll suggest basic components (Raspberry Pi 4’s version, some case and SD card) and a good looking, promising operating system.

Read More “Raspberry Pi-based computer for 80 USD or less?”

File upload blocked despite ALLOW_UNFILTERED_UPLOADS set to true

Some file types are reporting its MIME type different than it is associated with given file extension in WordPress database. Such file upload will be blocked for security reasons (.epub file in my case):

X.epub: Sorry, this file type is not permitted for security reasons

A special ALLOW_UNFILTERED_UPLOADS flag is used in WordPress in such situations. You should try it first. If you still have not satisfying results (i.e. you still can’t upload a file of certain type) then it may mean some MIME table changes made by either your plugin or theme or even a nasty bug in WordPress itself.

In all cases, using must-use plugin with some small filter should solve the problem.

Read More “File upload blocked despite ALLOW_UNFILTERED_UPLOADS set to true”

Disable automatic restarts in Windows 10

Windows knows better then you when to restart your computer. And Windows 10 is the most qualified in such knowledge. That’s why in some scenarios you may lost 40+ tabs open in your browser and a lot of programs running, when your Windows decided that it must be restarted right now.

There are many approaches to preventing Windows 10 from auto-restarting itself:

However, the solution that worked for me is “Disable Automatic Windows 10 Restarts” script at GitHub.

Increasing “Max upload file size” in WordPress the right way

To all those disbelievers — yes, uploading 1 GB or bigger files to WordPress is possible! :)

And you don’t have to play with some workarounds like uploading files through FTP and hard-linking them with your post. You can upload large file right in WordPress built-in file uploader.

However, a lot of steps may be needed before you will be able to achieve this.

Read More “Increasing “Max upload file size” in WordPress the right way”

Uploading MIME-conflicted ebooks and files to WordPress

Starting with 5.0.1 version WordPress introduced an additional security check, where file’s MIME type must match extension. So an attempt to upload any executable file file with .jpg extension will fail with:

Sorry, this file type is not permitted for security reasons

This can be a real pain when trying to upload certain ebook format, because this is exactly the case — a MIME-type conflicted with extension (at least as seen by WordPress). For example: Kindle’s .azw3 files declares itself (content; look inside) as BOOKMOBI. Or .epub format which has application/epub+zip as MIME-type and being a modified version of .zip file or actually a regular .zip file with some predefined content.

There are some ways to workaround this (discussed here), however, not all of them works, sorry!

Read More “Uploading MIME-conflicted ebooks and files to WordPress”

Batch-change value of thousands of cells in Excel sheet

There are milion of ways on modifying many cells’ value in single pass using… formula. But, what about a situation, when you need to perform only a single one-time bulk-change of value in many Excel’s cells?

I had a situation when I was preparing some IT project’s budget. Since I am an IT geek then writing amounts in thousands like 1,30k USD was no problem at all. However, this solution had two falls:

  • Some accounting freak, having nothing to do with IT, had problems understanding that “k” means thousands
  • Cells itself had to use some custom formatting of ##0,00k USD in order to add that damn “k”

Thus, I had to do a one-time recalculation of most of cells in my sheet to multiply their value by 1000.

Read More “Batch-change value of thousands of cells in Excel sheet”

Factory reset Kindle with semi-frozen screen

The steps for performing factory reset of a Kindle are quite easy:

  1. From the home screen, select Menu.
  2. Select Settings.
  3. Select Menu again then select Reset Device.

The problem appears when your screen is frozen and you don’t see anything or almost anything.

I had this situation that only tiny part of my screen was still responsive. I wasn’t able to see most of the menu and settings sections, but at least I managed to see:

  • When my Kindle is awaken
  • When its menu is or isn’t opened up (I didn’t see many menu items though)
  • Which page of Settings I am currently at

This allowed me to figure-out a key combination needed to blind-reset my Kindle.

If your Kindle has a completely dead screen and you don’t see anything of above then sorry, this article won’t help you.

Read More “Factory reset Kindle with semi-frozen screen”

Change page size when scanning in Windows 10

If you’re scanning images using Window’s native drives and software (i.e. not those provided by your scanner manufacturer) you may often hit the wall of not being able to change scanned page side due to fact that corresponding list is disabled:

In this article I’ll show you how to change this value (page size). But, keep in mind that this will be a one time solution. As far as I know there is now permanent solution for this problem.

Read More “Change page size when scanning in Windows 10”

Can’t enable BitLocker for pendrive or USB removable drive

If your pendrive or removable drive (after selecting it in This PC) has BitLocker button disabled (in Protect section of Drive Tools tab) or if you can’t see it listed in BitLocker itself then it is (currently) not supported. Most guides you’ll find will tell you that the destructive way of formatting drive is the only option.

That turned out to be not true, at least in my case. Simple deactivation of pendrive’s partition using DiskPart solved problem.

Of course you need Windows 10 Pro, because “lower” editions of this system does not have BitLocker.

Read More “Can’t enable BitLocker for pendrive or USB removable drive”

Different PHP versions per single hosting

Using simple one-liner in .htaccess file you can enforce different PHP version in two or more of your folders. If you have different websites / domains / services registered for each folder, you can as an effect have single hosting running two or more applications that requires different version of PHP parser.

Note that this will most likely work on shared hostings only, where your ISP provides different versions of PHP at your service and some web tool (i.e. cPanel) to switch between them. In most of such cases web tool allows you to pick the same PHP version for the entire hosting. With this solution you can have them different.

However, on your private servers and hostings you have to provide that different versions of PHP parser will be installed and made available.

Read More “Different PHP versions per single hosting”

Enable System UI Tuner on Android 11 and 10

System UI Tuner is gone from Android 11 and 10? Long-pressing config gear gives no effect? You no longer can control what (and how) is displayed in your status bar in Android device?

Well… not quite. It is still there. Only some weird person decided to remove access shortcut to it.

And you need to recreate it:

  • an activity in Nova Launcher, if you’re using it,
  • a Tasker script, if you are using it,
  • a standalone app, if none of above works for you.

The need of installing a 3rd party app only to enable some existing feature is as weird as it can be.

But, hey!, it Android, right?

Read More “Enable System UI Tuner on Android 11 and 10”

Turn off Bluetooth discoverability on Android devices

Some folks responsible for design and development of different Android versions or different UIs for this system must have some problems with their mental sanity, because they think that it is very funny to have your device discoverable to all surrounding devices whenever you only enable Bluetooth.

I don’t find it funny. Even more, I find it weird, bad and evil.

I had an issue with Xiaomi Redmi 6 phone, having MIUI 11 launcher installed. I find the regular way of turning off Bluetooth discoverability on this phone impossible and ended up with the need for installing some app.

This is a generic solution that may work in your case, even if you have some other Android gear, so I decided to share my experience here.

Read More “Turn off Bluetooth discoverability on Android devices”

Transfer private MP3 files from PC to iPhone SE 2020

It is not possible to simply copy files from PC to iPhone, over a cable. If you connect your iPhone (or probably any other Apple mobile device) to your PC, you will be only able to access “DCIM” folder and your photos or maybe videos. No way to copy MP3 music or audiobooks.

Using iTunes to achieve above was the simplest and preferred way in my case though this wasn’t as easy process as I expected. And that’s why I decided to wrote this article to let you avoid some bottlenecks.

If you’re looking for some other options or ways, like some non-iTunes way, this is also briefly discussed here.

Read More “Transfer private MP3 files from PC to iPhone SE 2020”

Listen to YouTube’s audio with screen turned off

It is impossible to use YouTube like an audiobook or audio source because a moment after your turn off your screen or after it is dimmed off due to timeout the playback is stopped and audio is cut-off.

To workaround this problem you can either consider or another YouTube client app:

or you can consider some other browser (namely Firefox).

Read More “Listen to YouTube’s audio with screen turned off”

Get rid of Redirect Notice from Google Calendar

Google wants to know everything about you. One of the way of achieving it is to put every link, you paste or write into any of their services (i.e. Gmail, Calendar etc.) through their own sniffing tool. In other words, anything like http://www.example.com, it will be turned into https://www.google.com/url?q=http://www.example.com or something similar.

For most Google services this being done nearly silently. You’re still sniffed at all paces, but your user experience isn’t affected. Sniffing and redirects are nearly invisible. All you can notice is a difference between URL you’re looking in browser and the one that you see in browser’s status bar.

However, there’s a on exception. It was proven many times that Google Calendar developers are a complete morons. And yes, they wasted up even their very own sniffing tool. Thus, whenever you click any link in Google Calendar, you see a supremely annoying “Redirect Notice” middle page.

Read More “Get rid of Redirect Notice from Google Calendar”

System interrupts kills PC / eats up to 100% of CPU

If your computer is suddenly slowing down noticeable and you have just:

  • installed a new driver or added new piece of hardware,
  • installed or started using some new hardware-related service (i.e. Internet phone, conference software)

then check Task Manager to see, if System interrupts isn’t consuming most of / all of CPU power of your PC.

Read More “System interrupts kills PC / eats up to 100% of CPU”

Removing some lines from .srt subtitle files

The .srt format seems to be most popular for storing subtitles for corresponding video files. It is very flexible (allowing you to define begin and end of displaying each phrase to the level of single frame).

One big disadvantage of this format is that it is indexed. Meaning that each following line has a consequential numbering. You cannot simply delete let’s say line number 511 (as you would do in case of .txt or other subtitle file formats), because you’d have to renumber manually all following lines. Which, in case of modern movies, can have up to 1000-2000 lines.

Thus, if you wish to get rid of some line or lines (i.e. sound-like sentence) you must either use some designated software that will do the auto-renumbering of the following lines (not covered in this article) or do this manually, keeping some tips in your mind.

Read More “Removing some lines from .srt subtitle files”