Youni.world

Get Bitcoin Price Using Bybit API in Bash

With Bybit API [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

Bash Script: Connect To Free VPN ProtonVPN With OpenVPN Configs

ProtonVPN allows to use Free VPN servers in Netherlands, USA, Japan. You may use official application for Linux, Android. But for fine configuring and connect just in one click need to connect with own script using OpenVPN configs by ProtonVPN. Here it is my own bash script for connect to the best protonvpn server in one click.

0. Prerequisits

Intall tor, torsocks, openvpn, resolvconf, jq

apt-get install tor torsocks openvpn resolvconf jq

Mine XMR On VPS Server Lowering CPU Usage

VPS have limited CPU and RAM usage. This is why it is hard to mine on VPS not being blocked for high consumption. I try to mine on Xeon Skylake 1 Core 2 Gb Ram.

1. Optimize Xmrig config.json

Get config.json from Xmrig wizard [1]. After first run xmrig will add many lines to your config. And you need to look at the next lines.

Under randomx object:  "mode": "light" - this makes xmrig uses 256 Mb of Ram.

Under randomx object: "1gb-pages": false - this is by default, use 2mb huge pages.