This file contains 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
#include <stdio.h> | |
enum TrafficLightState { | |
RED, | |
GREEN, | |
YELLOW | |
}; | |
void transition(enum TrafficLightState *state) { | |
switch (*state) { |
This file contains 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
#!/usr/bin/env python3 | |
import os | |
import re | |
import psutil | |
import tempfile | |
def get_swap_usage(): | |
swap_data = [] | |
total_swap = 0 |
This file contains 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
DNS error responses: | |
sudo tcpdump -vv -i any port 53 and '(udp[10] & 0x80 != 0) and (udp[11] & 0x0F > 0)' | |
SPecific query types: | |
sudo tcpdump -vv -i any port 53 and 'udp[12:2] = 0x0100' | |
Long response times: | |
sudo tcpdump -vv -i any port 53 and greater 500 | |
Malicious UDP traffic | |
sudo tcpdump -vv -i any not port 53 and 'udp[12:2] = 0x0100' | |
Specific domains: | |
sudo tcpdump -vv -i any port 53 and host example.com |
This file contains 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
filetype plugin indent on | |
" show existing tab with 4 spaces width | |
set tabstop=4 | |
" when indenting with '>', use 4 spaces width | |
set shiftwidth=4 | |
" On pressing tab, insert 4 spaces | |
set expandtab | |
" VIM Configuration File | |
" Description: Optimized for C/C++ development, but useful also for other things. | |
" Author: Gerhard Gappmeier |
This file contains 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
#include <stdio.h> | |
/* | |
Common bitmask operators and logic: | |
1. AND (&) | |
Purpose: Clear (set to 0) specific bits or only show bits that are already set. | |
Example: result = value & mask; | |
Keeps bits that are 1 in both value and mask. | |
2. OR (|) |
This file contains 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
exiftool -overwrite_original -EXIF:GPS* -EXIF:DateTimeOriginal= -EXIF:CreateDate= -EXIF:ModifyDate= -IPTC:Byline= -IPTC:BylineTitle= -IPTC:City= -IPTC:Sub-location= -IPTC:Province-State= -IPTC:Country-PrimaryLocationName= -XMP:Creator= -XMP:Description= ./*.jpg | |
exiftool -all= -tagsfromfile @ -icc_profile -ColorSpace -overwrite_original -ext jpg ./* |
This file contains 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
#include <stdio.h> | |
int main() { | |
int value = 10; | |
int *pointer = &value; | |
// print the address of the variable and the pointer value | |
printf("Address of 'value': %p\n", (void *)&value); | |
printf("Value of 'pointer': %p\n", (void *)pointer); |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
// demonstrate pointer basics | |
void pointerBasics() { | |
int a = 42; | |
int *ptr = &a; | |
printf("Pointer Basics:\n"); |
This file contains 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
#!/bin/bash | |
get_heap_size() { | |
local pid=$1 | |
local heap_size=0 | |
# Read the /proc/[pid]/maps file | |
while read -r line; do | |
if [[ "$line" == *"heap"* ]]; then | |
local start_addr=$(echo "$line" | awk '{print $1}' | cut -d'-' -f1) |
This file contains 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
iptables -P FORWARD ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -t nat -F | |
iptables -t mangle -F | |
iptables -F | |
iptables -X |
NewerOlder