Skip to main content

Posts

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 ot

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

Problem with postgres Index and database size on dedicated server

  Often it happens in the morning that you get up and then you see that your site is about 2-3 hours offline. If you see some message like.. OperationalError at file_name ERROR: all backend nodes are down, pgpool requires at least one valid node HINT: repair the backend nodes and restart pgpool You have to check df -h and see of space on hardrive is full. Or you can use Ncdu This is a very good command to find hard drive problems. First check that you are /var/logs. Sometimes this is caused by you forgetting the debugger in verbose mode. And you are running a hard drive full of logs. But in this case, we will check for more difficulties. I will write some design decisions to delete some unused indexes, but these indexes are automatically for very large database tables with about 25 million records and more. SELECT pg_size_pretty( pg_database_size(“db_name”) ); 894GB Show tables \dt Shows supper full output sorted by table and index size WITH RECURSIVE pg_inherit(inhrelid, inhparent) A

Elasticsarch Python combinated with Haystack delete objects by id

    I cannot delete objects from the index in real time by object ID. In this case, the Haystack django application cannot work properly. I need a custom script to move records out of the current table to archive and delete objects from the elastic  in real time.  Old version of the application, python 2 and old Elastic make it more difficult. See Example in Vindazo  vim job/management/commands/archiveringbykeyword.py  When you move a record to the archive and then delete them from the elastic index, the errors in haystack can happen. This fix will provide new opportunities for adding and deleting jobs after indexing and cleaning.  In old versions of Haystack it doesn't work as expected. And if It is not working properly, you need to run update_index or rebuild_index command every day. Example for low level python Elastic object removing without Haystack from elasticsearch import Elasticsearch es = Elasticsearch() res = es.get(index="jobs", id=result.id) es.delete(index=&

Backup & Recovery strategy

Using the snapshot function, you can create an image of the contents of the storage box. This way, you can restore content in a short time when you need it. Using this function, you can create a set of schedules for automatic snapshots. Please note that when you restore an earlier snapshot, all the newer snapshots will be deleted. When you create a new snapshot every month, and then back up your database and server configuration every 6th and 4th every week, then if the server is damaged, you will have more chances to get the data. Snapshots The snapshot is a complete image of the storage box. You can create them on the robot under "Storage Box". No space is required when the snapshot is created. It grows as you change or delete files. The newly added files in the snapshot do not require space. When making a snapshot, its storage space comes from the storage capacity of the storage box. (Each snapshot you make uses the space in the storage box.) You can reset the storage box