AWS ELB: redirect WordPress to HTTPS

With healthy.html on Health check

cat /var/www/html/.htaccess

# BEGIN WordPress

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !^/healthy\.html$
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

cat /var/www/html/wp-config.php

...
define('WP_HOME','https://www.example.com');
define('WP_SITEURL','https://www.example.com');

/** Detect if SSL is used. This is required since we are terminating SSL either on CloudFront or on ELB */
if (($_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'] == 'https') OR ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
{$_SERVER['HTTPS']='on';}

AWS ELB: redirect WordPress to HTTPS

Another bunch of useful plugins for Redmine

This is just for note and high performance outcome of your team 🙂

A lot of useful plugin can be found on this sites:
http://www.jbox-web.com/extensions-plugins-redmine.html (greetings fly out to France and JBox Web company, all of they plugins can be found in official repository)
https://www.redmineup.com (it’s former redminecrm)

Continue reading “Another bunch of useful plugins for Redmine”

Another bunch of useful plugins for Redmine

Run acestream via docker image on RPi

This manual as for running acestream engine using docker container-based virtualization technology inside debian-based RPi2/3, for example raspbian (not suitable for openelec etc.). In general docker is used for software isolation to it’s own domain and with a focus on automation.

You can install docker to RPi this way.

curl -sSL http://downloads.hypriot.com/docker-hypriot_1.10.3-1_armhf.deb >/tmp/docker-hypriot_1.10.3-1_armhf.deb
dpkg -i /tmp/docker-hypriot_1.10.3-1_armhf.deb
rm -f /tmp/docker-hypriot_1.10.3-1_armhf.deb
sh -c 'usermod -aG docker $SUDO_USER'
systemctl enable docker.service

Check if everything is installed.

sudo docker info

and

docker version

Then you can get docker images kindly prepared by sybtech
In case of acestream

docker run -i -t sybdata/docker-acestream-debproxy

In case of aceproxy

docker run -i -t sybdata/aceproxy

Command-line parameters -i and -t means to run docker images in interactive mode.

For more information please refer to docker official manuals. They are pretty straightforward.

Run acestream via docker image on RPi

Reset usb ports without rebooting (Windows)

For this purposes you will need devcon utility from Microsoft. This utility is no more than 100 KBytes in size, but in case you would like to use devcon-utility guys from Microsoft suggests you to download huge WDK iso-file (about 3 GBytes). Fortunately there is workaround which I’ve found here.

For Windows Xp/Vista + Windows Server 2003(R2) (as described by Microsoft here):

x86: Download Support.cab (which is Windows Server 2003 Service Pack 2 32-bit Support Tools) and extract “devcon.exe”. (download size: 3.45 MB)

amd64: Download w2k3sp2_3959_usa_x64fre_spcd.iso (which is Windows Server 2003 Service Pack 2, x64 Editions – ISO-9660 CD Image File) and mount the “.iso” file, then go to “SUPPORT/TOOLS/SUPPORT.cab” and extract “devcon.exe”. (download size: 475 MB)

For Windows 7/8/8.1/10 + Windows Server 2008(R2)/2012(R2)/2016:

x86: Download 82c1721cd310c73968861674ffc209c9.cab, extract the file “fil5a9177f816435063f779ebbbd2c1a1d2”, and rename it to “devcon.exe”. (download size: 7.73 MB)

amd64: Download 787bee96dbd26371076b37b13c405890.cab, extract the file “filbad6e2cce5ebc45a401e19c613d0a28f”, and rename it to “devcon.exe”. (download size: 7.29 MB)

All the links (except for the script) are provided by Microsoft, and both links to .cab files are the same links that WDK uses to obtain its packages.

Okay, now we have devcon-utility. What then?

  1. Enumerate internal root usb-hubs. Fire-up windows command-line in privileged mode, navigate to folder where is devcon stored and then type: devcon findall *ROOT_HUB* (this will return vertical list of available hubs)
  2. Then reset preferred usb-hub with: devcon restart <selected hub from vertical list>
  3. Or you can use wild-card matching and reset every hub you computer have with: devcon restart *ROOT_HUB*
  4. That’s all

One-second humor

Internal file filbad6e2cce5ebc45a401e19c613d0a28f contains interesting signature – filbad* – feel-bad. I don’t know is this really a coincidence 🙂

Reset usb ports without rebooting (Windows)

Disable Windows 10 automatic reboot after Anniversary upgrade

Smart guys from Microsoft really thinks that computer must be rebooted at any price after upgrades. I don’t think like this guys, because sometimes you need to leave some operation overnight without interrupting. At a current time there is no option to disable this behavior with built-in control panel.

To workaround this strange problem you can use this batch-script (which is found here):

:: Setting Active Hours Start (AHS) and End (AHE) times to 1 hour before the current time through 9 hours after the current time, i.e., a total of 10 hours window

@ECHO off
set /a AHS=%time:~0,2%-1
IF %AHS% LSS 0 set /a AHS=%AHS%+24
set /a AHE=%time:~0,2%+9
IF %AHE% GTR 24 set /a AHE=%AHE%-24
reg.exe ADD HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /v ActiveHoursStart /t REG_DWORD /f /d %AHS%
reg.exe ADD HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings /v ActiveHoursEnd /t REG_DWORD /f /d %AHE%

You have to create new task in task scheduler and place this script there.

This is the citation of author.

Save it as .cmd, place it in not-a-temporary place, and create a scheduled task in the Task Scheduler (Windows+R > taskschd.msc > Enter) which'll run it, say, every 8 hours (one hour before the changed active hours end time). Here is one way to create it which can ensure regular runs:
1. Create new task
2. General tab: set user account to SYSTEM OR User with highest privileges and check "Run whether user is logged on or not"
3. Triggers tab: 2 options:
A. 2 triggers - a. "On a schedule" + One time (choose any time for the 1st run) + Repeat task every 8 hours for a duration of "Indefinitely" b. "At log on of any user" (this ensures not missing the active hours reset when you reboot)
B. 1 trigger - "At log on of any user" and set to repeat every 8 hours indefinitely
4. Actions tab: Start program: Set the path of the file (use quotes if the path has spaces)
5. Conditions tab: Uncheck "... only on AC power"
6. Settings tab: Check "Run task as soon as possible after a scheduled start is missed" (further ensures that you don't miss active hours reset if the task fails to run as per schedule)

What this script is really doing? Just moving reboot time-frames over and over.

Disable Windows 10 automatic reboot after Anniversary upgrade

How to migrate IMAP to IMAP

You can use cross-platform imapsync utility for this purposes. You have to create empty mailboxes on destination server. Before deleting mailbox on source server check everything twice on destination server (i mean is everything really synced). You can ask user to use new mailbox for some time (e.g. one week is enough) and then if there is no feedback you can do with source mailbox everything you want.

Example command:

imapsync --dry --noexpunge --no-modules_version --host1 source.server.com --port1 993 --authmech1 LOGIN --user1 source.mailbox@source.server.com --password1 password.on.source.server --ssl1 --host2 destination.server.com --port2 993 --authmech2 LOGIN --user2 destination.mailbox@destination.server.com --password2 password.on.destination.server --ssl2 --syncinternaldates --split1 100 --split2 100 --useheader Message-ID

How to migrate IMAP to IMAP