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 / 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;
#!/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 / 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
}
@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 / 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 / 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
#!/bin/bash
set -eou pipefail
VERSION="$2"
cd /tmp
set -x
# trap "rm $5" EXIT
rm SHA256SUM || true
function exponentialBackoff(i, dt) {
const f = j => j >= 0 ? Math.exp(j/3)*dt : 0
const ret = f(i)-f(i-1)
if(ret < dt) {
return dt
} else {
return ret
}
}
@jan-swiecki
jan-swiecki / setup_mvn.sh
Last active April 15, 2021 10:55
Maven mvn setup JFrog password
#!/bin/bash
# go to ~/.m2 or other folder and run ./setup.sh according to below help
if [ -z "$3" ]; then
cat <<EOF
usage: ./setup.sh <jfrog_username> <jfrog_password> <artifactory_url>
example: ./setup.sh my_username my_password https://myjfrogaccount.jfrog.io/artifactory/mymavenrepositroyname
EOF
exit
fi