Skip to content

Instantly share code, notes, and snippets.

@weshouman
weshouman / .bashrc
Last active November 1, 2023 13:27
After installation todos #important #bash #linux #git
# I usually add a similar block to the .bashrc
####################################
##### My Stuff: Walid Shouman ####
####################################
# disable freezing, follow https://unix.stackexchange.com/a/72092/310075
stty -ixon
#~~~~~~~~~~~~~~~~~~~~~~~#
@weshouman
weshouman / shell_study.md
Last active October 18, 2023 16:16
shell study #bash #study
@weshouman
weshouman / Configuration.md
Last active October 4, 2023 07:18
apt tips and tricks

apt configurations are located in /etc/apt/ following is a breakdown for the different directories

Main Components

  1. sources.list: This is the main list of repositories that APT will use for software package management. Each line in this file specifies a different repository. Ref: man 5 sources.list

  2. sources.list.d/: This directory allows you to add additional repository lists without modifying the main sources.list file. Each file in this directory should end with .list and contain one or more repository lines, just like the main sources.list file. Ref: man 5 sources.list

@weshouman
weshouman / assignment_operators.md
Last active September 29, 2023 11:42
tips and tricks in creating your own makefile
  1. Simple Assignment (=):
    • It assigns a value to a variable.

    • The value of the variable is evaluated when the variable is used, not when it's declared.

    • This means that if you reference other variables in the assignment, their values will be expanded at the time of use, not at the time of assignment.

      FOO = $(BAR)
      BAR = Hello
      all:

@echo $(FOO) # This will output "Hello"

@weshouman
weshouman / bash tips.md
Last active September 29, 2023 10:43
bash tips and tricks

Execute but Keep the Current Working Directory

following code changes cwd to ./step1

cd step_1
./build.sh
./test.sh

adding braces gets the code executed w/o affecting the cwd

(cd step_1 && ./build.sh && ./test.sh)
@weshouman
weshouman / unittest_with_difftool.py
Last active September 29, 2023 08:13
A python wrapper to show differences using custom tools
import unittest
import tempfile
import subprocess
# One could use vimdiff, meld, or even diff
def diff_with(test_func=None, tool='vimdiff'):
# The decorator was used with parentheses
# thus the test_func is not set, we need to call it ourself
if test_func is None:
return functools.partial(diff_with, tool=tool)
@weshouman
weshouman / exploder.py
Last active September 21, 2023 21:51
Unentangling my yaml confusion
#!/usr/bin/python
# This script cleans up reference keys assuming they start with an underscore
import yaml
import argparse
def read_data(input_file):
# Read YAML file
with open(input_file, 'r') as f:
data = yaml.safe_load(f)
@weshouman
weshouman / README.md
Last active September 9, 2023 16:59
Cilium documentation summary
@weshouman
weshouman / README.md
Last active August 21, 2023 07:46
installation scripts for evdi kernel module
  • pip install pybind11: install requirements
  • pip3 show pybind11 | grep Location: to ensure installation
  • .\install_evdi.sh: install evdi
@weshouman
weshouman / README.md
Last active August 20, 2023 20:04
Kernel module dependency walker

Those scripts are used to walk the dependencies of the Kernel Modules in Linux.

Usage

One could use any of the following implementation, either on Python or Bash

Note: The python implementation is updated to use a cache, making it instantaneous

Python Script

Use any of the following commands