Resetare Windows 11
Soluția de forță majora pentru toate problemele Windows este reinstalarea sistemului de operare de la zero. Din fericire, puteți reseta Windows 11 fără a pierde totul.
[mai mult...]Soluții pentru problemele tale IT
Soluția de forță majora pentru toate problemele Windows este reinstalarea sistemului de operare de la zero. Din fericire, puteți reseta Windows 11 fără a pierde totul.
[mai mult...]Acesta este un instrument de depanare de la Windows, dar va trebui să îl descărcați separat de pe site-ul Microsoft. Instrumentul de depanare de securitate Windows scanează computerul și se asigură că toate caracteristicile de securitate sunt activate și funcționează conform intenției. Dacă credeți că setările de securitate ale computerului dvs. sunt incorecte sau nu sunt actualizate, acest instrument le va remedia automat.
[mai mult...]The AWS CLI is an essential tool for developers and sysadmin to automate and interact with AWS cloud services. It is an open-source tool built on the AWS SDL for Python. As a result, you no longer need to use AWS Management Console. Instead, you can use Linux terminal and commands for managing AWS resources.
$ sudo apt install awscli
$ sudo dnf install awscli
$ sudo dnf install awscli
# apk add aws-cli
$ sudo pacman -S aws-cli
$ sudo zypper in aws-cli
$ python3 -m pip install awscli
Do you want AWS cli version 2? Try:$ python3 -m pip install awscliv2
$ ~/.local/bin/awscliv2 --install
Make sure you include ~/.local/bin/ in your $PATH. For example, here is how to set up PATH on your Linux:# Step #1. Set PATH variable #
$ echo 'export PATH=$PATH:~/.local/bin' >>~/.bashrc
# Step #2. Set bash alias too #
$ echo 'alias aws="awsv2"' >>~/.bashrc
# Step #3. Use the source command to load changes #
$ source ~/.bashrc
$ aws --version
Depending upon your package manager and Linux distro, you may get the latest or older version. For instance, here is the output from my Ubuntu 20.04 LTS developer workstation:
aws-cli/1.18.69 Python/3.8.10 Linux/5.13.0-35-generic botocore/1.16.19
Here is outputs from v2:
2.1.1
AWS CLI v2 command: /home/ubuntu/.awscliv2/binaries/aws
aws-cli/2.4.28 Python/3.8.8 Linux/5.13.0-37-generic exe/x86_64.ubuntu.22 prompt/off
$ aws configure
$ aws s3 ls
2016-07-25 16:11:06 xyz-project-freenas 2020-07-03 13:55:47 xyz-project-forum .... ..
Your aws CLI credentials are stored in plain text inside ~/.aws/ directory. Therefore, do not share ~/.aws/ directory and files. You can view it using the cat command:
$ cat ~/.aws/credentials
It is possible to store credentials in an encrypted format. The other option is to use and enable AWS Multi-Factor Authentication (MFA). It is a best practice that adds an extra layer of protection for your credentials.
JSON is an acronym for JavaScript Object Notation. Often used in web apps, but it is not limited to JavaScript. One can use any programming language such as Perl, Python or CLI tools such as jq. CSV is an acronym for Comma-separated values. It is a text file you can use in spreadsheet apps, programming languages and many other apps.
Here the outputs of the df command in JSON format:
[ { "fs": "/dev/mapper/vgubuntu-root", "type": "ext4", "size": "915G", "used": "135G", "avail": "734G", "usedpercentage": "16%", "mounted": "/" }, { "fs": "/dev/nvme0n1p2", "type": "ext4", "size": "1.4G", "used": "378M", "avail": "939M", "usedpercentage": "29%", "mounted": "/boot" }, { "fs": "/dev/nvme0n1p1", "type": "vfat", "size": "511M", "used": "30M", "avail": "482M", "usedpercentage": "6%", "mounted": "/boot/efi" } ]
The JSON outputs in CSV format (all values are separated by a comma , value):
/dev/mapper/vgubuntu-root,ext4,915G,135G,734G,16%,/ /dev/nvme0n1p2,ext4,1.4G,378M,939M,29%,/boot /dev/nvme0n1p1,vfat,511M,30M,482M,6%,/boot/efi
So how do you convert such input? The answer is to use jq or dasel command-line utilities.
Since jq is available in most common repos, I will use that one for my needs. Here is how to install jq on a Debian or Ubuntu Linux using the apt command/apt-get command:
$ sudo apt install jq
RHEL/Fedora/CentOS/Alma/Rocky Linux user try the dnf command:
$ sudo dnf install jq
Alpine Linux user try the apk command:
$ sudo apk add jq
SUSE or OpenSUSE Linux user try the zypper command:
$ sudo zypper in jq
macOS / OS X user install homebrew and then use the brew command:
$ brew install jq
The syntax is as for df.json:
$ cat df.json | jq
Now let us extract the fs field, run:
$ cat df.json | jq '.[] | .fs'
How about both fs and type fields?
$ cat df.json | jq '.[] | .fs, .type'
To generate CSV file with , as separator use the following syntax:
$ cat df.json | jq '.[]| join(",")'
The join(",") joins the array of elements given as input, using the argument , as separator:
"/dev/mapper/vgubuntu-root,ext4,915G,135G,734G,16%,/" "/dev/nvme0n1p2,ext4,1.4G,378M,939M,29%,/boot" "/dev/nvme0n1p1,vfat,511M,30M,482M,6%,/boot/efi"
Pass the -r raw option to get rid of double quotes:
$ cat df.json | jq -r '.[]| join(",")'
Let us consider the following file displayed using the bat/cat command$ cat bingbot.json
$ batcat bingbot.json
Sample config:
{ "creationTime": "2021-11-10T10:00:00.121331", "prefixes": [ {"ipv4Prefix": "157.55.39.0/24"}, {"ipv4Prefix": "207.46.13.0/24"}, {"ipv4Prefix": "40.77.167.0/24"}, {"ipv4Prefix": "13.66.139.0/24"}, {"ipv4Prefix": "13.66.144.0/24"}, {"ipv4Prefix": "52.167.144.0/24"}, {"ipv4Prefix": "13.67.10.16/28"}, {"ipv4Prefix": "13.69.66.240/28"}, {"ipv4Prefix": "13.71.172.224/28"}, {"ipv4Prefix": "139.217.52.0/28"}, {"ipv4Prefix": "191.233.204.224/28"}, {"ipv4Prefix": "20.36.108.32/28"}, {"ipv4Prefix": "20.43.120.16/28"}, {"ipv4Prefix": "40.79.131.208/28"}, {"ipv4Prefix": "40.79.186.176/28"}, {"ipv4Prefix": "52.231.148.0/28"}, {"ipv4Prefix": "51.8.235.176/28"}, {"ipv4Prefix": "51.105.67.0/28"} ] }
The final goal is to produce .CSV file as follows: for my WAF:
157.55.39.0/24,BingBot 207.46.13.0/24,BingBot 40.77.167.0/24,BingBot 13.66.139.0/24,BingBot 13.66.144.0/24,BingBot 52.167.144.0/24,BingBot 13.67.10.16/28,BingBot 13.69.66.240/28,BingBot 13.71.172.224/28,BingBot 139.217.52.0/28,BingBot 191.233.204.224/28,BingBot 20.36.108.32/28,BingBot 20.43.120.16/28,BingBot 40.79.131.208/28,BingBot 40.79.186.176/28,BingBot 52.231.148.0/28,BingBot 51.8.235.176/28,BingBot 51.105.67.0/28,BingBot
First type the following to get CIDR prefixes:
$ cat bingbot.json | jq '.prefixes[]'
Then pipe outputs to create new JSON to add a comment field:
$ cat bingbot.json | jq -r '.prefixes[] | {cidr: .ipv4Prefix, comment: "BingBot"}'
Finally, use the join() to make a .CSV file:
$ cat bingbot.json | jq -r '.prefixes[] | {cidr: .ipv4Prefix, comment: "BingBot"} | join(",")'
Save it:
$ cat bingbot.json | jq -r '.prefixes[] | {cidr: .ipv4Prefix, comment: "BingBot"} | join(",")' > bingbot.csv
Verify it:
$ cat bingbot.csv
Uneori un mouse sau o tastatura conectata prin Bluetooth va intra in Sleep mode in urma unei perioade de inactivitati, iar utilizatorul este nevoit sa astepte ca dispozitivul sa iasa din Sleep mode.
[mai mult...]In situatia in care avem o statie mai veche, aceasta este foarte lenta, deoarece utilizeza un Hard Disk vechi. Cum putem folosi memoria ram pentru asta?
[mai mult...]