Skip to content

Instantly share code, notes, and snippets.

View jan-swiecki's full-sized avatar

Jan Święcki jan-swiecki

View GitHub Profile
@jan-swiecki
jan-swiecki / bash_args_parse_example.sh
Created April 13, 2022 11:26
bash_args_parse_example.sh
#!/bin/bash
usage () {
cat<<EOF
usage: ...
EOF
}
while [[ "$#" -gt 0 ]]; do
case $1 in
@jan-swiecki
jan-swiecki / lib_packet_parse.py
Last active January 2, 2023 08:29
python-raw-packet-tools
from __future__ import annotations
from argparse import ArgumentParser
from dataclasses import dataclass
from math import ceil, floor
from pathlib import Path
import re
from typing import Callable
RLEN = 50
@jan-swiecki
jan-swiecki / hist.awk
Last active February 23, 2023 08:15
hist.awk
#!/usr/bin/awk -f
# Original script: https://stackoverflow.com/a/39637429/1637178
# License: https://creativecommons.org/licenses/by-sa/3.0/
# This one works with integers
# Example:
# $ du -s some_folder/* | awk '{ print $1; }' > sizes
# $ ./hist.awk sizes
#
# Change bin_width, bar_scale_down and %5d accordingly
@jan-swiecki
jan-swiecki / yara_test.yar
Created March 16, 2023 18:36
yara_test.yar
rule Hello {
strings:
// A string to match -- default is ascii
$ascii_string = "hello"
condition:
// The condition to match
$ascii_string
}
#!/bin/bash
# This script doesn't work with apt-get update (even with -q). Kill -0 exits immediately.
print_empty_lines() {
for x in $(seq "$1"); do
tput el
echo
done
}
@jan-swiecki
jan-swiecki / side-by-side-iframe-sync-scroll.html
Created April 13, 2025 13:00
side-by-side-iframe-sync-scroll.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Side-by-Side HTML Viewer</title>
<style>
/* Ensure the body takes the full height */
html, body {
margin: 0;
padding: 0;