A
Alternatives
alternatives --list: list all alternatives
Change python version
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.12 2
sudo update-alternatives --config python
# Then select number of version to be usedAnother option is using ln: sudo ln -sf /usr/local/bin/python3.12 /usr/bin/python
Asar
An ASAR file is an archive used to package source code for an application using Electron, an open source library used to build cross-platform programs. It is saved in a format similar to .TAR archives where files contained in the archive, such as .HTML, .JS, and .CSS files, are concatenated together without using compression.
To extract
Install NPM: sudo apt install npm
Install asar using npm: npm install -g asar
-g: install to global mode
default is local which is current project directory
Extract all files: asar extract <archive.asar>
Extract one file from archive: asar extract-file
Resource
https://fileinfo.com/extension/asar
AWK
Arithmetic Expressions
+
Arithmetic
Addition
7 + 3 = 10
–
Arithmetic
Subtraction
7 – 3 = 4
*
Arithmetic
Multiplication
7 * 3 = 21
/
Arithmetic
Division
7 / 3 = 2.33333
%
Arithmetic
Modulo
7 % 3 = 1
String
Concatenation
7 3 = 73
Autoincrement and autodecrement operators
x++
–y
Assignment Operators
+=
Add result to variable
-=
Subtract result from variable
*=
Multiply variable by result
/=
Divide variable by result
%=
Apply modulo to variable
Conditional expressions
==
Is equal
!=
Is not equal to
>
Is greater than
>=
Is greater than or equal to
<
Is less than
<=
Is less than or equal to
These operators can be used to compare numbers or strings
With strings, lower case letters are greater than upper case letters
A value of 0 is false, anything else is true
Undefined variables has the value of 0
Regular Expressions
~
Matches number ~ /(one
!~
Doesn’t match word !~ /hello/
Sample Scripts
Extract lines and sublines
Combine lines
Keep the first line intact
On the second line
Replace everything from :! and trailing spaces with comma
Removes the text "type is " or "serial number is " from that line
Combines both line into a single output line
Result will be
Similar to above script but also replace :! and trailing spaces with comma on the first line and remove "type is " as well
Reference:
https://likegeeks.com/awk-command/ https://www.grymoire.com/Unix/Awk.html
Last updated