Skip to content

Instantly share code, notes, and snippets.

@githubfoam
githubfoam / hpc experience
Last active June 10, 2020 15:49
hpc experience
-------------------------------------------------------------------------------------------------------------------------------------------------
$ 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
@githubfoam
githubfoam / go lang experience
Last active April 7, 2023 12:45
go lang experience
-------------------------------------------------------------------------------------------------
# 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
@githubfoam
githubfoam / bash script cheat sheet
Last active March 23, 2026 03:33
bash script cheat sheet
-----------------------------------------------------------------------------------------------------
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
@githubfoam
githubfoam / suse experience
Created July 1, 2020 10:24
suse experience
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
@githubfoam
githubfoam / fio cheatsheet
Last active November 9, 2026 10:06
fio cheatsheet
-----------------------------------------------------------------------------------------------------
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
@githubfoam
githubfoam / github actions cheat sheet
Last active March 23, 2026 03:33
github actions cheat sheet
============================================================================
#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
============================================================================
@githubfoam
githubfoam / linux_osquery
Last active May 29, 2025 12:00
linux_osquery
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,
@githubfoam
githubfoam / macos_osquery
Last active July 15, 2021 10:18
macos_osquery
#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
@githubfoam
githubfoam / windows_osquery
Last active September 11, 2023 18:16
windows_osquery
PS C:\Users\Administrator> osqueryi
Using a virtual database. 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
@githubfoam
githubfoam / nagios_core_experience
Last active August 15, 2023 12:13
nagios_core_experience
--------------------------------------------------------------------------------------------------------------------
#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