Basic commands to open, zip and unzip archives

zip  is  a compression and file packaging utility for Linux, Unix OS, MAC and MS zip utility comes handy with another companion program called unzip, unzip is used to list, test and extract zip archivesBasicusage;zip basicusage;Zip command line program can be used to compress files as;zip -{flags} {package} {item}Example on how tozipafileusingzipYou can zip and compress a file as;zip filename.mp3Zip will get the command to package filename.mp3 and store it in an archive named pack.zipHowtocompress a directorywith zipDirectories can be archived using the -r flagYou can zip and compress a directory as;zip -r directoryHowtounzipfilesusingunzipunzip a companion program to zip is used to extract archives typed unzip followed by archive name to extract a package as;unzip  {filename}for example;unzip

Tar basic commands to store and extract files

Targeted is an archiving program designed to package, store, and compress multiple files into a single portable package the name tar is an abbreviation for tape archiverApart from creating .tar archives tar is also capable of compressing files using zip, bzip2, and gzip compression algorithmsTar flagsc — compress directive
x — extract directive
t — tabulate contents
f — specify filename
z — use zip/gzip compressionj — use bzip2 compression
k — do not overwrite
t — files from file
w — ask for configuration
v — verbosegzip flagsd — decompress fileTar commandline commands syntaxtar -{arguments} {params}Example tar commandstar -cf music.tar music.mp3Tar archiver will be directed to compress music.mp3 into a tar archive named music.tar and save it in the current working directorytar -xf music.tarTar will be directed to extract music.tar archive and save the constituent contents of the archive in the current working directoryhowtomake a zip archivesusingtarTar can compress zip files as well…

How to install tfjs JavaScript library

Tensorflow is a hardware accelerated JavaScript library for building, training, testing and deploying machine learning models on a JavaScript runtime environment.
Installation through html script tag For use within the browser you can link to jsdelivr content delivery network using an html script tag as follows;
<script src="[email protected]/dist/tf.min.js"></script>
Installation through npm package manager Alternatively you can install a self hosted version of tensorflow from npm, in your terminal type;
npm install '@tensorflow/tfjs'
Installation for tfjs-node on npm tensorflow has two nodejs packages made specifically for nodejs
Installation for '@tensorflow/tfjs-node' This version is a cpu only version it doesn't utilize gpu to do the computing, install tfjs node by typing;
npm install '@tensorflow/tfjs-node'
Installation for '@tensorflow/tfjs-node-gpu' This version is arguably faster than the …

String repeat in JavaScript

String repeat is a function that can be used to multiply a string for a given number of times, its a feature that is closely related to string multiplication operator in Python programming language, as compared to Python's syntax;
("String") * (number of times to repeat) "A" * 3
// returns "AAA"
Something similar may be archived using string repeat function in JavaScript as;
("String").repeat(number Of times to repeat)
For example to triple "A" you can do as;
Practical example is with lyrics;
const part = "i feel you, "
const lyrics = part.repeat(4) + " A, B, C" // "i feel you, i feel you, i feel you, i feel you, A, B, C"
Further reading;
String.prototype.repeat() MDN

Lambadas in kotlin programming language

Lambadas are similar to arrow functions in JavaScript they are a short alternative method to declare functions in kotlin programing language, You can create a function expression as;
val double = {num: Int -> num * 2} val cube = { num: Int -> num * num * num} val square = {num: Int ->
    val product = num * num
    product }
The last expression in a lambada is considered as a return value; Parameters can be omitted, for a single parameter lambada the value of the omitted parameter is in the variable 'it'

Rest operator in JavaScript

Rest operator is similar to spread operator its an es6 feature that allows converting arguments to an array of values;

Syntax of spread operator is as follows;

function spr(...params) { console.log(params) } spr(1,2,3) // [1, 2, 3] You can use rest operator among other arguments

function sprr(args, ...params) { console.log(params) } spr('foo', 1, 2, 3) // [1, 2, 3] More information:
Restparameters MDN

JavaScript String includes function

String includes is a function introduced to JavaScript in Escmascript 'es6' that returns a boolean true , or false based on the evaluation whether or not a string contains the string passed as an argument to the function For example;

const str = "John swana" str.includes('John') // true str.includes('duke') // false Running string includes testing whether 'John swana' includes John returns trues as it's a fact.

Running the same string against duke returns false duke is not part of the string 'str'

comparison on var, let and const variable declaration

let, const and var are keywords used for variable declarations in JavaScript programming language,const and let were newly introduced to the programming language in Escmascript es6 or es2016.Declaration keywords
the syntax of declaring a variable using let keyword is done as;let {variable name} = valuefor const it's done as;const {variable name} = valuesimilarly with var;var {variable name} = valueScope for 'let' and 'const' variables
let and const declared variables are block scoped that means values assigned remain within the block of assignment;
take for instance;if(true) {
   const declaration = "declared"
}console.log(typeof declaration)
// undefinedvalues remain accessible only within the if blockScope for 'var' variables
var declared variables are function scoped so variables declared within a function are only accessible within the function it's self for example;function assign(param){
    var assignment = param;

Es6 destructuring operator in JavaScript

JavaScript from es6 enables destructuring operation,
In JavaScript destructuring is done using the syntax;
const [elements] = [array] const {properties} = {object}
For instance using Math object as an example destructuring can be done as follows;
Object matching syntax;
const {abs, min, max} = Math;
List matching syntax;
const [max, min, avg] = [10, 1, 5]
Fail-soft destructuring similar to object property look up returns undefined if there's no property matching;
var [item] = [];
item === undefined;
Fail-soft destructuring can also be done with predefined default vslues as follows;
var [item = 1] = [];
item === 1;
More information: MDNDestructuringassignment

How to write a self invoked function in JavaScript

Self invoked functions are function that run on themselves without need to be called, the syntax to create self invoked functions is as follows;

(function(){ // function body })() the runtime will run everything in a self invoked function's body You can pass parameters to the function using the syntax below;
(function(params){     // function body })(params) parameters will be made available to the function as any other argument