Youni.world

Add Date and Time to Each Line in ffmpeg Log with awk

When transcode video or catch bugs in live stream, sometimes it is necessary to log ffmpeg messages with also date and time. This is possible with awk.

 

Insert date and time to ffmpeg log messages using awk

Here we use test stream link from [3]. We run ffplay for check its work:

ffplay https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8 2>&1 | awk 'NF {print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush()}'

Explanation:

How to Run PHP-FPM 8.0 and PHP-FPM 7.4 Simultaneously for Different Sites on Centos 7 Nginx

Running websites on different CMS or different versions of the same CMS, it is usual that some sites need PHP 7.4, others PHP 7.2 and others can work on PHP 8.0 and so on. Centos 7 now has several php-fpm packages, and this article describes how to run two or more php-fpm services and configure nginx to use certain php version for certain site.

 

1. Update to PHP 8 on Centos if you still did not

Check current php version

php -v
  PHP 7.4.30 (cli) (built: Jun  7 2022 08:38:19) ( NTS )

Get Bitcoin Price Using Bybit API in Bash

Edited at 2024-04-06 15:17 UTC. With Bybit API v5 [1] it is possible to get public data (price, volume, last trading records) and also place own orders using API Key. All the next examples do not need API Key, because open public data is used here.

First, install jq for read json data and search in it to get only fields we need.

apt install jq

 

Bitcoin price in Spot trading from Bybit API. Ticker BTCUSDT info

This price is from latest finished orders.

SpeedUp Mouse Wheel on Linux

Increase wheel speed on Linux using imwheel. This will make scrolling easier, while use Chromium, Firefox, LibreOffice, viewing pdf files in Evince.

 

1. Install imwheel

apt install imwheel

 

2. Check the applications names

Check the names of applications that should be affected by imwheel settings. Run in terminal:

Configure Mouse Buttons as Copy and Paste on Linux

Extra mouse buttons on the side or also click on the wheel can be used for copy and paste or any other actions. To make extra buttons work as you need on Linux use next steps from ArchLinux wiki [1].

 

1. Install xbindkeys and xvkbd

xbindkeys allows to bind mouse buttons to any action like open terminal, open browser, copy to clipboard, paste.

xvkbd allows to send to system keyboard pressing like Ctrl + C, F5 and so on.

apt install xbindkeys xvkbd

 

Bitcoin Checksum on Bash

Checksum is often used in Bitcoin when generating public key, address. Checksum is a simple method for error-checking data [1].

In Bitcoin blockchain the checksum is generated by running SHA256 function two times in a row.

Important note: need to use sha256 in binary mode for binary data.

 

Bitcoin checksum on Linux Bash: sha256sum

This is an example used on learnmeabitcoin [1] and this bash analogue gives the same result:

Which HelloWorld Is Faster: Rust, C, C++, Bourne Shell, Python3?

Which program works faster? Does Rust compiler do things extra fast? Here are our simplest programs on Rust, C, C++, Bash, Python3. They were run 100.000 times and timings are measured.

 

Listings

Listing HelloWorld on Rust, main.rs

fn main() {
    println!("Hello, World!");
}

 

Listing HelloWorld on C, main.c

#include <stdio.h>
int main() {
    printf("Hello, World!\n");
    return 0;
}

 

Error on `git pull`: Permission denied (publickey). fatal: The remote end hung up unexpectedly

Sometimes my Devuan unexpectedly close the session, because of some JavaScripts on websites. After re-login I cannot connect to remote git repository with errors:

$ ssh remote_server
$ git pull
Error reading response length from authentication socket.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Some people advise to start ssh-agent and load keys to ssh-agent, but that does not work in my case:

Python: Search Beautiful Address And Its Private key On Tron Network

Tron Network has addresses that start with 'T' and have length 34 symbols. If you wish convenient address like TMYNAME93LRv...91F with 'MYNAME' string, so use my script on Python3.

 

TronPy Beautiful Address Generator

Generates Tron Network addresses using tronpy library and writes addresses and private keys to log.txt