Skip to content

Instantly share code, notes, and snippets.

View navarrothiago's full-sized avatar
🎯
Focusing

Thiago Navarro navarrothiago

🎯
Focusing
View GitHub Profile
@ayoubzulfiqar
ayoubzulfiqar / folder_structure.md
Created September 5, 2023 06:12
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@shiponcs
shiponcs / remove_dups.cpp
Created February 25, 2023 17:57
Remove All Adjacent Duplicates In String- solve using stack
string removeDuplicates(string toCleanUp) {
std:stack< char > str_stack;
for(char x : toCleanUp) {
if( !str_stack.empty() && x == str_stack.top() ) str_stack.pop();
else str_stack.push( x );
}
string res;
res.reserve(str_stack.size()); // reserve the space so that the concatenation speeds up.

Topology

+--------+     VLAN 280      +------+
|       0+-------------------+      |
| trex   |     VLAN 290      |      |
|       1+-------------------+      |
+--------+                   |      |
                             |      |
+--------+     VLAN 280      |      |
@nyrahul
nyrahul / cdump.sh
Created April 16, 2021 18:55
tcpdump for pod controlled by cilium
#!/bin/bash
# Usage: $0 <pod> [tcpdump-filter]
[[ "$1" == "" ]] && echo "Usage: $0 <pod> [tcpdump-filter]" && exit 1
ep_id=`kubectl get cep -A -o jsonpath="{.items[?(@.metadata.name==\"$1\")].status.id}"`
iface=`cilium endpoint get $ep_id -o jsonpath="{[*].status.networking.interface-name}"`
shift
@williamcaban
williamcaban / iperf-pods.md
Created August 2, 2020 22:22
Using client/server iperf pods

Using iperf Pods

  • Create namespace or project for running iperf tests:
oc new-project iperf-test
  • Create server Pod
rm -f pod-iperf-server.yaml 
@grahamwhaley
grahamwhaley / sdrsharp.png
Last active July 17, 2024 03:04
Running SDR# under Linux/wine
sdrsharp.png
@MarioHewardt
MarioHewardt / enable_ebpf_on_wsl2
Last active December 27, 2024 08:01
Enable EBPF on WSL2
By default, EBPF programs will not run on WSL2 due to required kernel modules missing. The following example error is an
indication of this problem:
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.84-microso
ft-standard/modules.dep.bin'
modprobe: FATAL: Module kheaders not found in directory /lib/modules/4.19.84-microsoft-standard
chdir(/lib/modules/4.19.84-microsoft-standard/build): No such file or directory
To fix this you need to rebuild the WSL2 kernel with the missing kernel modules. The below instructions are for Ubuntu 18.04 WSL2.
1. git clone https://github.com/microsoft/WSL2-Linux-Kernel.git
@karlredman
karlredman / joplin-keymap.json
Last active September 2, 2023 04:51
vim-sh keymap.json for Joplin Terminal Application (CLI)
[
{ "keys": [":"], "type": "function", "command": "enter_command_line_mode" },
{ "keys": ["q"], "type": "prompt", "command": "exit", "cursorPosition": -1 },
{ "keys": ["/"], "type": "prompt", "command": "search \"\"", "cursorPosition": -2 },
{ "keys": ["TAB","l"], "type": "function", "command": "focus_next" },
{ "keys": ["SHIFT_TAB","h"], "type": "function", "command": "focus_previous" },
{ "keys": ["UP","k"], "type": "function", "command": "move_up" },
{ "keys": ["DOWN","j"], "type": "function", "command": "move_down" },
{ "keys": ["PAGE_UP","K","u"], "type": "function", "command": "page_up" },
@wknapik
wknapik / .zshrc
Last active December 28, 2022 13:55
[tmux/zsh] Print matching lines of output (stdout and stderr) from the last command run in an interactive shell, without rerunning the command
# This function greps everything between the last two prompts in the current tmux pane.
# Arguments are passed to `grep -i', so any valid `grep' options can be supplied.
# Requirements: coreutils, grep, sed, tmux, zsh.
just() {
local -r max=10000 psone="$(print -P "$PS1"|sed "s,\x1B\[[0-9;]*[a-zA-Z],,g")"
local inside=0;
tmux capture-pane -pS-"$max" -E"$max"|tac|\
while IFS= read -r line; do
case "$inside,$line" in
package main
import (
"fmt"
"net"
"os"
"time"
bpf "github.com/iovisor/gobpf/bcc"
"github.com/florianl/go-tc"