Skip to main content

Posts

Static site generation from keyword.txt file and publish it in Firebase

  From keywords.txt file we will generate templates to fill it with content.  vim keywords.txt Add one keyword per line..  For example,  Aanbieding Binnendeuren Aanbiedingen binnendeur python startpage.py Then you will see generated templates. For example: input/02-aanbieding-binnendeuren.html input/03-aanbiedingen-binnendeur.html Fill generated templates with content.  Then  vim sitemapgen.py  and update from .. to counts..  This will read file names from the filesystem and generate a sitemap in the current input directory.  input/sitemap02-10.html Then run python include script to make AMP pages from templates.  Python include.py  Then publish all these generated files.  firebase deploy And add it in the Git directory so you can follow changes. 

Firebase install CLI Mac

 You can install the Firebase CLI using a method that matches  your  Mac operating system, experience level, and/or use case. No matter how you install the CLI, you can access the same features and firebase commands.  So this is the command to install it. curl -sL https://firebase.tools | bash    

Python3 on Mac

First install development tools then you can do the following   sudo python3 -m pip install --upgrade pip  or somthing what you need in python3 sudo python3 -m pip install slugify

Read-only file system hardware fault in RAID

When you are getting errors from a file system like this..   cd /hom-bash: cannot create temp file for here-document: Read-only file system -bash: cannot create temp file for here-document: Read-only file system -bash: cannot create temp file for here-document: Read-only file system You have new mail. Last login: Tue Jun 15 13:16:58 2021 from 188.118.0.104 mktemp: failed to create file via template ‘/tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX’: Read-only file system touch: cannot touch ‘’: No such file or directory ERROR: virtualenvwrapper could not create a temporary file name. It could be a hardware problem. Due to a hardware fault, you have to replace your server while taking over the hard drives. Furthermore both of my drives are faulty with one of them not even recognised by the system anymore. Mount your hard drive and back up my data and accept the full configuration loss for the server in order for us to replace them. When my server has been booted into our rescue system

Live streaming from video camera to laptop OBS Facebook, Youtube, Twitch, Restream.io RTMP server

I did a live stream a few days ago. I would save and share configuration because it was not immediately obvious how to do it.. Config camera for streaming it will be in Menu something like REC SET and choose AVCHD 1080 / 50i or XAVC S HD but or XAVC S 4K if your network connection can stream it. In my case AVCHD compression was the best choice. First step is getting video input to computer for that you need HDMI cable and a CAM Link This link is very good because all possible cameras will fit in this setup. HDMI is very useful. Next thing we need OBS obsproject.com it will convert and optimize streams for channels. Install it on your computer and configure it like in the screenshot below. Facebook stream get it from your page or account Pay attention! You can use the browser and then choose a cam link there but you can't configure speed and resolution of the stream and can get problems with bandwidth. Maybe that is a good choice to stream webcam but not successful if you want to

Other storage on your Macintosh HD

  If you look at your Mac's storage capacity, part of it will consist of an "Other" bar. At first glance, you can't tell what exactly these files are, which also makes it very difficult to delete them. The 'Other' storage bar can consist of several things. Documents, plug-ins and the cache are stored here. These files are important to keep your Mac running smoothly, but if you're not careful this part can fill up quickly. Especially if you have a MacBook with limited storage capacity, it may sometimes be necessary to slim down the amount with 'Other' storage. To do this you will first need to find the Other category. Here's how you can see how much space is taken up by other storage: Click the Apple logo at the top left of your Mac screen. Choose About This Mac > Storage. You will now see how your Mac storage is composed, including 'Others'   It may take a while before the information is visible. Now that you know how much space the

How do I add an extra / additional hard drive?

The technical support team can add an extra SSD. For installing the drive, we need to shut down your server (downtime ~ 30 min). If as requested we have added the drive to the server and restarted it. You can format the filesystem and add drive to your OS. In this case Ubuntu server. lsblk NVMe (Non-Volatile Memory Express) is a specification for accessing drives through PCI Express; it is tailored to meet the needs of non-volatile memory. For example, the connection via PCIe Gen3 x4 (32 GBit/s) provides five times faster access speed and lower latency than the traditional SATA 3 (6GBit/s) interface. Due to the high degree of parallelism and low energy consumption, they allow users to meet current and future memory needs. mkfs.ext4 -j -L backup /dev/nvme2n1  apt-get install  nvme-cli Getting information about hard drive  nvme list nvme id-ctrl /dev/nvme2n1|egrep "sn |mn " blkid /dev/nvme2n1 /dev/nvme2n1: LABEL="backup" UUID="378cdb81-98c8-44b7-95a2-22bd60a0707b

Perform commands with Python over ssh

I need to run some commands on a remote computer. Manually, I will log in with ssh and run the command. How would you automate this in Python? You  need for example to log in to the remote computer with a (known) password, so I can't just use cmd = ssh user @ remotehost, and then use the paramiko module for authentication and automation on the server side.  Very simple example: ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(server, username=username, password=password) ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd_to_execute) If you are using ssh keys, do: k = paramiko.RSAKey.from_private_key_file(keyfilename) k = paramiko.DSSKey.from_private_key_file(keyfilename) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname=host, username=user, pkey=k) Or  commands.getstatusoutput("ssh machine 1 'your script'") www.paramiko.org Paramiko is a Python (2.7, 3.4+) implementation of the SSHv

Can't Use apt i.e. /boot is 100% full

  Note: Only in cases where cleanup cannot be done with apt due to 100% full/boot Get a list of kernel images and determine which will be removed. This command will display the installed kernels, except for the currently running kernel dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r` linux-image-4.15.0-46-generic linux-image-4.15.0-50-generic linux-image-4.15.0-51-generic linux-image-4.15.0-52-generic linux-image-4.15.0-54-generic Linux-image-4.15.0-55-generic First, get the list of currently running Linux kernels and run: v="$(uname -r | awk -F '-virtual' '{ print $1}')" 4.15.0-47-generic Use brace expansion to keep your boot clear, you can write a command to delete all files in /boot that are not related to the kernel. Remember to exclude the current and two latest kernel images. In the example above, it is rm -rf /boot/*-4.15.0-{46,50,51,52,54,55}-* Or move these files in another directory. mv /boot/*-4

Sendgrid simple integration on localhost python TinyDB sendgridclient

  Configure mail to send email from a local host without any platform. Sometimes, you need a quick application to test an idea, but don't want to invest in a separate server with DKIM, SPF and other tools installed, but only need to test a business case for 2-3 months. The perfect tool for sendgrid that you can control via your laptop. There is no need to pay for the server and django, and there is no need to use a completely naive integration without a code solution. This API integration is at least 3 times cheaper than any other solution on the market, and it can be used for professional purposes. Note this integration only works for small lists of about 200k-300k maximum. Otherwise database is too slow and updates are slower than postgres or other databases.   Register your account on the Sendgrid website. Then, at this point in the API configuration wizard are out of date docs. Ignore it!  We use the code found on github. See the example below.   This is an old version in docs

Install WebDriver Chrome or Firefox for Selenium for automated testing web application

Installation for automated testing  sudo apt-get update apt-get install -y unzip openjdk-8-jre-headless xvfb libxi6 libgconf-2-4   apt-get install firefox Pip install selenium Sometimes you can get some exceptions  Selenium “Unable to find a matching set of capabilities” despite driver being in /usr/local/bin Or selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities Updating Firefox and Selenium solved it for me. I don't pretend to have an explanation for the root cause however. Updated Firefox 48 → 53 Updated to Selenium 3.4.1 https://pypi.org/project/selenium/ https://github.com/mozilla/geckodriver/releases   Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line Firefox browser has installed?  apt-get install firefox  Script example for chrome WebDriver automated installation on Ubuntu  #!/usr/bin/env bash