Skip to content

Malaczynski.eu Posts

Magic Mirror Birthday Updater

Year after year I have to update my birthday calendar on magic mirror. I use this solution:

https://forum.magicmirror.builders/topic/10126/getting-google-contacts-birthdays-into-calendar

But this year, some bugs made it impossible for me.

10:41:30 AM
Error
Exception: You have been creating or deleting too many calendars or calendar events in a short time. Please try again later.
Sync_Birth_Cal
@ 

I do nothing with this error, only ran the script again and again.

10:44:50 AM
Error
Exception: You have been creating or deleting too many calendars or calendar events in a short time. Please try again later.
Sync_Birth_Cal
@ 

This was more of a challenge. But one command added in last for loop fixed this problem.

  for (var t in eventToCopy){
    var newEvent = calendarDestination.createEvent(eventToCopy[t].getTitle(), eventToCopy[t].getStartTime(), eventToCopy[t].getEndTime());
  Utilities.sleep(500)
  }

Nginx subfolders

I wanted to publish another site on my server. Now I have Nginx and WordPress but how to publish another site lets say on address malaczynski.pl/test/?

We will use Nginx web server.

I put all new site files in /var/www/test folder,
now I open Nginx config:

 sudo nano /etc/nginx/sites-available/wordpress.conf

and add before last } :

location /test {
    root /var/www;
}

transfer.sh

It takes me a while to finish a post about Magic Mirror. It was too laborious to pull out the config file. But now I know transfer.sh site. It main functionality is “Easy file sharing from the command line” and it really was easy.

$ curl --upload-file ./config.js https://transfer.sh
https://transfer.sh/EDqx8K/config.js

And this is everything.

Edit. It is not a blessed by good program. I have no idea how to delete the file. Delete link generator is not working. And the worst is that Firefox block this site as a “This website is on the list of sites with potentially dangerous content.”

Windows 10 virtual desktops

It was something new to me when I realized that windows 10 has virtual desktops. Here are some shortcuts to enable and use them:

Windows key + CTRL + D Add a virtual desktop
Windows key + CTRL + Arrow right Switch to the virtual desktop on the right
Windows key + CTRL + Arrow left Switch to the virtual desktop on the left
Windows key + CTRL + F4 Close the current virtual desktop

Automatic switching off all lights

I came up with another NFC automation idea.  When I go to bed all the motion sensor activated lights are on. To turn them off, I stuck an NFC tag on the radiator knob and added that code to the Home Assistant automation file. Now when I touch the knob with my phone all the lights in the house are turned off.

- alias: lights_off_tag
  initial_state: true
  trigger:
    platform: tag
    tag_id: b542b144-2e75-4f7c-bede-a6dd8d149a25
  action:
    service: light.turn_off
    entity_id: all

Migration to a new server

Ok, I migrated.

Services that I have transferred:

  1. Gmail forward
  2. Mysql base
  3. WordPress
  1. It was simple, deleted on one host and added on another. I didn’t have to change anything with my domain registrar. When I configured it, I added the appropriate DNS entries.
  2. I thought I didn’t need to do anything because it’s a shared database, but it turns out I need to copy all the data and restore it to the new account. I did this using Adminer. It has easy import and export options.
  3. WordPress eh, scared me at first. I went to my first post about installing WordPress and noticed that the linked page had changed xD Well, this post is already worthless anyway, but a lesson for the future to make screenshots of pages.

New site: https://websiteforstudents.com/how-to-install-wordpress-on-ubuntu-linux-with-nginx/

I did everything without a database (I already have one) and Let’s Encrypt (Cloudflare provides me with an SSL certificate). Speaking about Cloudflare, I changed the IPv6 address in their configuration for the new server.

The last thing I did was copy the entire WordPress directory and overlay the old one on the new installation. That was the hardest part, because I didn’t know how to copy data from one VPS to another.

rsync -avzhe 'ssh -p 10XXX' --progress /var/www [email protected]:/var/www

Performed on the old server fixed the issue.
I used the instructions from this webpage: https://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

Edit. It wasn’t.

The last thing was to change wp-config.php file to change database name, username, password and host.

New server

Few days ago I received an email from my VPS provider with happy news of the new server being released to me. They migrate to the new architecture and remove the old one. My upgrades are: Faster connection (1Gbps), SWAP replaced by more RAM, faster drive (SSD NVMe), updated kernel (5….). I recommend this lifestyle. And my provider Mikr.us.

ps. I also bought a 256MB RAM and 5GB HDD upgrade for 30PLN for a one-time fee, so my wordpress server should now be much faster.

Hidden administrative shares

Believe me or not, but in Windows there is a hidden administrative shares that you can see when you enter in the cmd terminal command:

net share

Most important share is c$.

Lets say you have to connect remote computer and upload some files, you have an administrator right, you know destination IP address, but you don’t know how to do it. So you go to PC and must locally use pendrive or email, or other remote share. And then I come all in white and say: backslash backslash one hundred ninety-two dot one hundred sixty-eight dot oł dot one hundred and one backslash c dollar

\\192.168.0.101\c$

Autostart clean up

Video about finding hidden startup programs and deleting unnecessary ones.