Monday, January 23, 2023

ChatGPT according to ChatGPT

There's a new craze in town.. and it's really a game changer.

ChatGPT is a large language model developed by OpenAI. It is based on the GPT (Generative Pre-training Transformer) architecture, which uses deep learning techniques to generate human-like text. ChatGPT is trained on a massive dataset of text from the internet and can generate a wide range of text, from simple responses to complex articles and stories.

One of the key features of ChatGPT is its ability to understand and respond to context. For example, if you ask ChatGPT a question, it can provide a relevant and accurate answer based on the information it has been trained on. Additionally, ChatGPT can also generate text in a variety of styles, such as formal or casual, depending on the input it receives.

ChatGPT is widely used in various applications, including chatbots, virtual assistants, automated writing, and language translation. It can also be fine-tuned to perform specific tasks such as question answering, summarization, and text classification.

In summary, ChatGPT is a powerful language model that can generate human-like text and understand context. Its ability to perform a wide range of tasks and its flexibility make it a valuable tool for many applications.

Thursday, December 16, 2021

RHCSA Study Points

    I recently took the RHCSA RHEL8 Exam and manage to passed it. I would say this study points from the Redhat website is accurate. You don't need to deviate outside this scope. An obvious tip was to make sure the server is bootable every time you edit FSTAB to add partitions. Failure to do this might cause you the exam.

Source: Red Hat Certified System Administrator (RHCSA) exam (EX200)

RHCSA exam candidates should be able to accomplish the tasks below without assistance. These have been grouped into several categories.

Understand and use essential tools
  • Access a shell prompt and issue commands with correct syntax
  • Use input-output redirection (>, >>, |, 2>, etc.)
  • Use grep and regular expressions to analyze text
  • Access remote systems using SSH
  • Log in and switch users in multiuser targets
  • Archive, compress, unpack, and uncompress files using tar, star, gzip, and bzip2
  • Create and edit text files
  • Create, delete, copy, and move files and directories
  • Create hard and soft links
  • List, set, and change standard ugo/rwx permissions
  • Locate, read, and use system documentation including man, info, and files in /usr/share/doc
Create simple shell scripts
  • Conditionally execute code (use of: if, test, [], etc.)
  • Use Looping constructs (for, etc.) to process file, command line input
  • Process script inputs ($1, $2, etc.)
  • Processing output of shell commands within a script
  • Processing shell command exit codes
Operate running systems
  • Boot, reboot, and shut down a system normally
  • Boot systems into different targets manually
  • Interrupt the boot process in order to gain access to a system
  • Identify CPU/memory intensive processes and kill processes
  • Adjust process scheduling
  • Manage tuning profiles
  • Locate and interpret system log files and journals
  • Preserve system journals
  • Start, stop, and check the status of network services
  • Securely transfer files between systems
Configure local storage
  • List, create, delete partitions on MBR and GPT disks
  • Create and remove physical volumes
  • Assign physical volumes to volume groups
  • Create and delete logical volumes
  • Configure systems to mount file systems at boot by universally unique ID (UUID) or label
  • Add new partitions and logical volumes, and swap to a system non-destructively
Create and configure file systems
  • Create, mount, unmount, and use vfat, ext4, and xfs file systems
  • Mount and unmount network file systems using NFS
  • Extend existing logical volumes
  • Create and configure set-GID directories for collaboration
  • Configure disk compression
  • Manage layered storage
  • Diagnose and correct file permission problems
Deploy, configure, and maintain systems
  • Schedule tasks using at and cron
  • Start and stop services and configure services to start automatically at boot
  • Configure systems to boot into a specific target automatically
  • Configure time service clients
  • Install and update software packages from Red Hat Network, a remote repository, or from the local file system
  • Work with package module streams
  • Modify the system bootloader
Manage basic networking
  • Configure IPv4 and IPv6 addresses
  • Configure hostname resolution
  • Configure network services to start automatically at boot
  • Restrict network access using firewall-cmd/firewall
Manage users and groups
  • Create, delete, and modify local user accounts
  • Change passwords and adjust password aging for local user accounts
  • Create, delete, and modify local groups and group memberships
  • Configure superuser access
Manage security
  • Configure firewall settings using firewall-cmd/firewalld
  • Create and use file access control lists
  • Configure key-based authentication for SSH
  • Set enforcing and permissive modes for SELinux
  • List and identify SELinux file and process context
  • Restore default file contexts
  • Use boolean settings to modify system SELinux settings
  • Diagnose and address routine SELinux policy violations
Manage containers
  • Find and retrieve container images from a remote registry
  • Inspect container images
  • Perform container management using commands such as podman and skopeo
  • Perform basic container management such as running, starting, stopping, and listing running containers
  • Run a service inside a container
  • Configure a container to start automatically as a systemd service
  • Attach persistent storage to a container

As with all Red Hat performance-based exams, configurations must persist after reboot without intervention.

Sunday, November 10, 2019

Kill Process run by your User Account

There are times when you are testing a process and have to restart it again and again.

Instead of doing a ps -ef to know the pid and kill it manually every time, you can automate the process by using the following in a script.

kill `ps -ef | grep \`whoami\` | grep myProcess | grep -v grep| awk '{print $2}'`

The ps command on your flavor may use "ax" instead of "ef".  Where myProcess is the process that needs to be restarted.  The awk commands gets the 2nd field of the line, which in this case is the PID

Sunday, March 18, 2018

Comparing two files without using DIFF


This is a a short way to compare 2 files on a Unix box without using DIFF. You can remove the option to output it to a file "> file3" if you want to see the output first.



If you want to see the uniq entries without the duplicates then output to a file:

Command:

sort file1 file2 | uniq -u > file3



If you want to see just the duplicate entries use "uniq -d" option then output to a file:

Command:

sort file1 file2 | uniq -d > file3

Friday, January 06, 2017

WIFI script for systemd init systems


I used the following Steps to create a startup script that will automatically connect my WIFI after a reboot. Not sure if there are more efficient way but this works for me so far. I normally do minimum install so there's no GUI running on my Linux machine. Tested it on Ubuntu 16.10 Yakkety.

Pre requisite
a. Disable network-manager service.
b. You need root access.



1. Create wifi WPA supplicant config appropriate for your Wifi Connection. The example was based on using WPA-Personal (Security Mode).

vi  /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="WIFI SSID (ex FreeWIFI)"
        psk="wifipassword"
        key_mgmt=WPA-PSK
        proto=RSN WPA
        pairwise=CCMP TKIP
        group=CCMP TKIP
}


2. Create the script that will contains the CLI command that connects the wifi

vi /*path*/wifi.sh
#!/bin/bash
/sbin/wpa_supplicant -Dnl80211 -iwlp2s0 -c/etc/wpa_supplicant.conf &

------
*Change the *path* to a folder of your choice (do the same on Step 3)
wlp2s0 - is the name of your wifi interface name. Run "ip addr sh" if you're not sure.


3. Create the systemd  init script file

vi /etc/systemd/system/wifi.service
[Unit]
Description=This will and connect the wifi @ startup

[Install]
WantedBy=multi-user.target

[Service]
Exec=/*path*/wifi.sh
Type=oneshot
RemainAfterExit=yes


4. ADD the systemd init script during Startup using systemctl:

systemctl daemon-reload
systemctl enable wifi.service
systemctl start wifi.service


5. Reboot your system to test if script works

reboot

==================================================

On second note just run nmtui if your network manager is working fine will save you the trouble of manually creating the wpa_supplicant file. The tutorial above works best if you're only connecting to 1 wifi connection and you don't expect the linux box or server to be more elsewhere.

Saturday, November 19, 2016

Task Automation without API through Headless Browser

I've been researching lately on headless browsing as I have this automation idea that can literally put me on early retirement. For those of you who are looking to automate some task but the Site you're relying on don't have any available API to work with then this might solve your problem. Special thanks to my colleague Huy who suggested the idea.


Undertanding Headless Browser:
https://en.wikipedia.org/wiki/Headless_browser

PhantomJS - This is a good headless browser
http://phantomjs.org/

CasperJS - You can create simple javascript code using this which makes interaction and navigation with your headless browser so much easier.
http://casperjs.org/

Sunday, April 13, 2014

Modify FSTAB on CentOS or RHEL 6 on Bootup

Ever encounter a problem when you can't boot due to corrupted or wrong FSTAB entry. Here's a simple fix

Problem:

Solution:

a. At  Grub press any key
b. Press "e" to edit

c. Under kernel parameter Append this command "init=/bin/bash"
d. Press Enter then "b"
e. This will take you directly to #.. Remount the / by typing  mount -o remount,rw /
f.  Edit fstab vi /etc/fstab
g. Save and Reset the system