This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ------------------------------------------------------------------------------------------------------------------------------------------------- | |
| $ cat Makefile | |
| F90 = gfortran | |
| TARGET=hello | |
| OBJECTS = $(TARGET).o | |
| FCFLAGS = -g -pg -fbounds-check | |
| OPFLAGS = -Ofast -O3 -O2 -O1 | |
| #PROFILERS = gprof strace ltrace valgrind | |
| all: build-gprof build-strace build-ltrace build-valgrind |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ------------------------------------------------------------------------------------------------- | |
| # official Go downloads page https://go.dev/dl/ | |
| ------------------------------------------------------------------------------------------------- | |
| sudo snap install go --classic #Ubuntu | |
| ------------------------------------------------------------------------------------------------- | |
| cd /tmp | |
| export GOVERSION="1.18" | |
| curl -O https://dl.google.com/go/go$GOVERSION.linux-amd64.tar.gz | |
| tar -xvf go$GOVERSION.linux-amd64.tar.gz | |
| sudo mv go /usr/local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ----------------------------------------------------------------------------------------------------- | |
| Common Ways to Run a Bash Script | |
| You can execute a Bash script in several different ways, each affecting: | |
| Which shell runs it, | |
| Whether a new shell process is created, | |
| Which environment variables are used, and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| zypper ref #Refreshing Repositories | |
| zypper update -y #update all installed packages with newer version as far as possible | |
| #Reboot is required to ensure that your system benefits from these updates. | |
| zypper --non-interactive --quiet install bcc-tools bcc-examples git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ----------------------------------------------------------------------------------------------------- | |
| Read Test | |
| fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=0 --size=512M --numjobs=4 --runtime=240 --group_reporting | |
| ----------------------------------------------------------------------------------------------------- | |
| writes a total 2GB files [4 jobs x 512 MB = 2GB] running 4 processes at a time: | |
| fio --name=randwrite --ioengine=libaio --iodepth=1 --rw=randwrite --bs=4k --direct=0 --size=512M --numjobs=4 --runtime=240 --group_reporting | |
| ----------------------------------------------------------------------------------------------------- | |
| Read Write Performance Test | |
| fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=random_read_write.fio --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ============================================================================ | |
| #how to delete a workflow from GitHub Actions? | |
| https://stackoverflow.com/questions/57927115/anyone-know-a-way-to-delete-a-workflow-from-github-actions | |
| ============================================================================ | |
| gists | |
| ============================================================================ | |
| https://api.github.com/users/githubfoam/gists | |
| `html_url` list gists | |
| ============================================================================ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * FROM block_devices; | |
| SELECT * FROM users WHERE gid < 65534 AND uid >= 1000; | |
| # finds all users who have actual login shells | |
| SELECT * FROM users WHERE shell NOT LIKE '%false' AND shell NOT LIKE '%true'; | |
| SELECT * FROM users WHERE shell="/bin/bash" | |
| #Querying the socket_events table | |
| SELECT pid, remote_address AS address, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #all local user accounts that exist on a machine | |
| SELECT * FROM users WHERE username NOT LIKE '\_%' ESCAPE '\'; | |
| # finds all users who have actual login shells | |
| SELECT * FROM users WHERE shell NOT LIKE '%false' AND shell NOT LIKE '%true'; | |
| #listening ports | |
| SELECT p.name, address, port, family, protocol, | |
| COALESCE(NULLIF(pos.path,''), p.path) AS path | |
| FROM listening_ports AS pos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PS C:\Users\Administrator> osqueryi | |
| Using a [1mvirtual database[0m. Need help, type '.help' | |
| #search for all local user accounts that exist on a machine | |
| osquery> SELECT * FROM users WHERE username NOT LIKE '\_%' ESCAPE '\'; | |
| #shows the top 10 memory hogs running on a system. | |
| SELECT pid, name, | |
| ROUND((total_size * '10e-7'), 2) AS memory_used | |
| FROM processes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -------------------------------------------------------------------------------------------------------------------- | |
| #ChatGTP | |
| #parent child relationship between hosts | |
| Define the parent host: In this example, we'll define SwitchA as the parent host. We can define this in the Nagios configuration file by adding the following line: | |
| define host{ | |
| use generic-switch | |
| host_name SwitchA | |
| alias Switch A |