Youni.world

Switch NumLock on at startup in Xfce4

There are many ways to switch on NumLock in Linux. Some methods do not work. I used this one before:

1. Switch NumLock on at startup using numlockx in .xinitrc

apt install numlockx

cat .xinitrc
#!/bin/sh

if [ -e /usr/bin/numlockx ]; then
  /usr/bin/numlockx on
fi

But now i prefer simpler way, using Xfce4 settings.

LXDE: Add Keyboard Shortcut For Open Terminal With One Button

Using terminal very often it is convenient to start terminal with some keyboard shortcut, for example with just pressing Right Menu button (right button with logo). This is how to do that.

LXDE works with Openbox, so there is a file ~/.config/openbox/lxde-rc.xml with some configurations, also there are Keyboard shortcuts:

 

1. Edit ~/.config/openbox/lxde-rc.xml

Open file for editing with vim or any editor like gedit, mousepad or so:

vim ~/.config/openbox/lxde-rc.xml

Install Avian from Source on Linux

Avian is a new cryptocurrency that is on its start. Code based on bictoin core, fees are extra low. The compilation process looks the same. This article should help you some issues, such as install Berkeley DB version 4.8.

Here it is complete process of building Avian with errors and solutions.

 

Rsync to Android

Connecting Android to your Linux you need to use gvfs. Rsync also wants to set files timestams that is why you need this hack.

 

0. Install gvfs-fuse

For use MTP devices in terminal need to use gvfs-use:

apt install gvfs-fuse

and reboot.

 

1. Find MTP device in /run/user/1000/gvfs

ls /run/user/1000/gvfs
'mtp:host=Samsung_A7_caf675d6'

Next follow to that folder you need to store your data.

 

Compare Time and Dates in Bash. And the Simplest Alarm on Bash

Using bash it is possible to compare time easily in epoch format. If you need to compare date like 14:23 with 14:17 you need to transform it to seconds since epoch and compare as two integers. Here it is my function in ~/.bashrc and examples

 

Bash: Count Minutes and Seconds since Start of a Process

Starting long process you may want to watch how much time is it going. This helps you to guess how much time remains.

Usually you run some process and then watch on it in another terminal window in a loop `while [ 1 ]`.

For example, need to count minutes since the process start. Algorithm and simple bash script are here.

 

1. Store the start time in seconds in a variable

start=$(date +%s)

This stores start point as POSIX time in seconds like: 1660042758

 

Fill USB Flash with Zeroes on Linux

When formatting usb flash, it always only creates new partition table at the start sectors and remain all the rest as it was. So, it is possible to read the rest data, analyze and get old data if your flash will be in hacker's hands. If your data must be totally removed from flash, it needs to fill entire drive with zeroes.

 

Fill USB flash with zeroes with dd if=/dev/zero of=/dev/flash

Simplest way is to use 'dd', but it takes much time and reduces lifetime of usb flash:

dd if=/dev/zero of=/dev/FLASH