Handy regular expressions

This is just a memo for myself to remember all regular expression that I often use:

  1. Remove sh*t from movie’s subtitles:
  2. Other:

Surround with / for JavaScript (and JSON?). Thus first example (\(([^)]+)\)) becomes /\(([^)]+)\)/.

Probably no use for anyone else except me, sorry! :>

Getting rid of forsaken “winmail.dat” sent by Microsoft Outlook

In many situations or scenarios Microsoft Outlook, instead of regular (consumable by other mail clients) meeting invitations can start sending “windmail.dat” instead. This is a proprietary format that other mail clients (like Thunderbird, Mac mail clients, web clients) ignore as not readable.

List of situations and configuration switches that may cause Outlook to behave like this is long. And so is the solution list. In my case only the most aggressive solution worked.

Read More “Getting rid of forsaken “winmail.dat” sent by Microsoft Outlook”

Say bye, bye to any website screenshot stuff. Chrome DevTools 62 are here…

If you’re using any kind of software or browser’s plugin for capturing entire website, viewport areas longer than current screen or just a small pieces of website then with new Google Chrome DevTools 62 you can say bye, bye to all of them!

You can now capture screenshot of selected node (which includes capturing entire page, as I’ll show you) directly in DevTools in Google Chrome 62.

It is said that you can also capture a screenshot of selected part of viewport, but I managed to get this working only two times per ten on less than 10% of websites. Thus, I decided to not write about it.

Read More “Say bye, bye to any website screenshot stuff. Chrome DevTools 62 are here…”

One-line UTF-8 encoded text files in Total Commander…

…are not correctly detected by it’s internal Lister viewer.

They’re detected as binary files in this case and if they contain any character from outside Latin range, Lister will most likely display such characters incorrectly (Total Commander does not do automatic UTF-8 detection in binary mode). According to TC’s author this is a correct and expected behavior.

Lister needs at list one line brake to correctly detect text file as UTF-8 encoded.

New Outlook’s calendar meeting with default signature

One of many wrongs, fuckups and things that are missing in Microsoft Outlook is the fact that you can’t set default signature for every new calendar meeting invitation, as you’d do for any new email message.

Things gets even worse as you dig through the problem and realize that Outlook developers were stupid enough to force you to design a whole new meeting template instead of just giving you an option to enable or disable this feature (as — again — it works in case of emails).

This guide is a redesigned version of this Stack Overflow answer (or actually this comment).

Read More “New Outlook’s calendar meeting with default signature”

HP LaserJet Pro M426fdn settings and factory reset

When running my HP LaserJet Pro M426fdn for the first time I didn’t removed touchscreen foil and my finger slipped over when selecting location of my printer. I ended up with having proper language but location set to Estonia and some reports (like Google Cloud Print configuration leaflet) printed in cyrylic.

Unfortunately, due to extreme stupidity of HP engineers you can only change language of your printer using standard configuration menu. But, in order to change location of the printer you have to perform a full factory reset of your hardware.

And here my problems started, because none of the solution I found seemed working on my printer.

Read More “HP LaserJet Pro M426fdn settings and factory reset”

Add one or more folders to .zip archive

To add single directory (with all files and sub-directories) simply execute:

zip -r zip_file_name.zip name_of_your_directory

To add all contents of current directory (again, recursively) call instead:

zip -r zip_file_name.zip *

While to add two or more directories (but not all) in current directory — list them:

zip -r zip_file_name.zip directory_a directory_b directory_c

Call just zip to see all switches, options etc.

Limit Android-based device functionality to an absolute minimum

If you ever need to turn some Android-based device (like a spare tablet) into single-function device (like auto-started browser with precisely selected website and all other functions disabled) then there’s a great article at Android Enthusiasts that explains in quick, sharp words, what you need to achieve this (some time and cash).

Read More “Limit Android-based device functionality to an absolute minimum”

chown: Recursively change owner of all files and folders

Sometimes QNAP changes file owner to admin:administ (actually to admin:administratorsadmin user in administrators group) which may cause some troubles on certain FTP operations when you’re logged in to QNAP’s FTP server with user different than admin (using this user to operate on FTP is a quite great mistake and you should always use other, less privileged user for this).

Using chown command you can easily fix this.

Read More “chown: Recursively change owner of all files and folders”

Access website via MAC address

There are several ways, how one can access a website. Using domain name (i.e. http//www.example.com/) is one of most popular. We can also use IP address (i.e. http://216.58.194.174/). In certain situations URL can be “enhanced” with port number, login and password etc.

Less known option is that in internal network you can access an URL using… MAC address. You only need to enclose it inside square brackets i.e.:

http://[49d7::2e27:fe80:fe0d:d8ff]/webservices.html

This will, of course, work in any other situation where you know MAC address of the destination device.

Save search results to file

When you press Alt+F7 in Total Commander, you have access to really powerful search functionality. Unfortunately, the Load/Save tab allows loading and saving of search parameters, not the search results.

However, there’s a hidden gem that allows you to copy search results to clipboard and then you can paste them to Notepad and save them to file. Just press Ctrl+C when list of search results is focused. A single “blink” of window will tell you that contents are copied to clipboard.

Solutions for Google Chrome loosing all passwords…

…and other synced data.

If you purge your local sensitive data in one of computers (i.e. on shared PC) while you’re logged-in to your Google account then — due to some serious stupidity in Google Chrome — you will purge the same set of data from your Google account as well. Each device that syncs data with this account will, as a result, purge its local sensitive data next time it contacts Google servers.

This article presents a list of solutions you can try to apply in situations like this.

Read More “Solutions for Google Chrome loosing all passwords…”

Replace all sound-like sentences in subtitles

I’m as big fan (maniac) of perfectly crafted movie subtitles as I’m a regular expression newbie (ignorant). I simply don’t understand them and I’m pretty scared of each attempt / need of using them.

Until today, my biggest problem about movie subtitles were “sound-like” sentences. Manual removal of 100+ lines out of 400+ subtitle files wasn’t and option. Today, I said to myself, that I’m going to sit by the computer until I don’t figure out a regular expression, which I can feed into Notepad++ and replace all of this junk-like (at least to me) text out of each of my movie subtitle.

So I did. Finding proper regular expression for such extremely easy task is a snap of fingers for every regular expression freak. For regexp-ignorant, like me, it took no more than five minutes, so I managed to get on time for diner back home.

Read More “Replace all sound-like sentences in subtitles”

The solution for Windows Update error code 8024200d

If your Windows Update process hits the wall with error code 8024200d then you may find really strange solutions, including suggestions to restart all services and boot system in a clean mode.

The truth is that error 8024200d means nothing more than the fact that Windows Update downloaded a malfunctioned version of update. And this is the only reason on why it is not able to install it.

And the solution is as simple as — install it manually by yourself.

Read More “The solution for Windows Update error code 8024200d”

Prepare Windows 7 installation USB stick

I’ve got brand new Intel NUC Kit. With powerful processor, lots of RAM, M.2 disk and… absolutely no way to install Windows 7 except for using properly prepared USB stick. And so, for the first time in my life, I have a no-DVD computer and for the first time in past seven years (since I started using Windows 7) I was forced to figure out good, old Windows 7 USB installation way.

Read More “Prepare Windows 7 installation USB stick”

Use own photos as desktop wallpapers in Windows 7

Using own images as desktop wallpapers in Windows 7 isn’t that easy and obvious task, because most of the time clicking Browse... button in Control Panel > Appearance and Personalization > Personalization > Desktop Background simply brings no effect.

And there are many solutions to workaround this problem. Of which the brute-force one I prefer the most.

Read More “Use own photos as desktop wallpapers in Windows 7”

Disable CSS transitions and animations… temporarily or permanently!

There’s a fairly easy way to diable all transformations, transitions and animations introduced in CSS3, which often are being used in a nasty way, just as Flash animations were used ten years ago and as .gif images were used twenty years ago.

This can be done purely in CSS, when disabling them permanently or with a little bit help from Javascript (actually jQuery or Zepto), when willing to disable them just for some time or event.

This article also show how to set styles for absolutely every element in document.

Read More “Disable CSS transitions and animations… temporarily or permanently!”

Rename mobile device in Windows 7

I’m testing my mobile applications on various number of mobile devices with Windows Phone system on-board. And Windows 7’s creators are stupid enough to develop this feature in the way, that all Windows Phone-based devices are named Windows Phone. Eventually, I ended up with four different mobile phones listed in Devices and Printers section under Windows Phone name. I needed a way to rename each of them to display correct model.

This is possible in Windows 7 and this is fairly easy, though pretty nice hidden, so some may claim that renaming mobile device is not possible.

Read More “Rename mobile device in Windows 7”

Ultra-fast method of creating hyperlinks in Microsoft Word

The most basic way of adding a “connector” from one part of Word document to another section, header or place is achieved by adding a bookmark followed by creating a hyperlink to that bookmark. This is a two-step process that involves using two different windows and a lot of typing and clicking.

There’s a much, much faster one-way method of achieving the same.

Read More “Ultra-fast method of creating hyperlinks in Microsoft Word”