Skip to content

Instantly share code, notes, and snippets.

View weshouman's full-sized avatar

Walid Shouman weshouman

  • Stuttgart, Germany
View GitHub Profile
@weshouman
weshouman / .bashrc
Last active September 29, 2023 18:46
After installation todos #important #bash #linux #git
View .bashrc
# 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 / assignment_operators.md
Last active September 29, 2023 11:42
tips and tricks in creating your own makefile
View assignment_operators.md
  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
View bash tips.md

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
View unittest_with_difftool.py
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
View exploder.py
#!/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 / 1-simple.mk
Last active September 10, 2023 20:36
Makefile function example
View 1-simple.mk
PATH = /tmp/
define myfn
processed_input=${PATH}/$(2)
$(1) := $$(processed_input)
endef
mytarget:
$(eval FILE=myfile)
$(eval $(call myfn,abs_filename,$(FILE)))
@weshouman
weshouman / Configuration.md
Last active September 9, 2023 17:02
apt tips and tricks
View Configuration.md

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 / README.md
Last active September 9, 2023 17:00
eBPF tips and tricks
View README.md

The eBPF (Extended Berkeley Packet Filter) language is a low-level assembly-like language that is specifically designed for writing programs that can be loaded into the Linux kernel. These programs are typically used for networking, security, and observability tasks.

eBPF has its own domain-specific language (DSL), following are some information about it.

Characteristics of eBPF DSL:

  1. Low-Level: The language is closer to assembly than to high-level languages like C.

  2. Limited Instructions: eBPF has a limited set of instructions to ensure that programs are safe to run in the kernel space.

@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
View README.md
  • pip install pybind11: install requirements
  • pip3 show pybind11 | grep Location: to ensure installation
  • .\install_evdi.sh: install evdi