Skip to content

Instantly share code, notes, and snippets.

View svagionitis's full-sized avatar

stavros vagionitis svagionitis

View GitHub Profile
@svagionitis
svagionitis / wget-mirror-website.sh
Last active March 14, 2024 08:27
A script to mirror a website using wget
#!/bin/sh -eu
# A script to mirror a website using wget
usage() {
cat << EOF
Usage: $(basename "$0") [-w website] [-u user_agent] [-b]
Where:
-w The website to mirror. The website will be like "https://example.com/"
-u The User agent to use. If no User agent is specified,
a Firefox default one is used.
@svagionitis
svagionitis / Create_Iframe_Index_M3U8.bash
Last active January 13, 2024 13:42
Segment an mp4 file to HLS streaming files
#!/bin/bash
# Create an Iframe index from HLS segmented streams
# $1: Filename to be created
# $2: Location of segmented ts files
# Check how many arguments
if [ $# != 2 ]; then
echo "Usage: $0 [Input filename] [Location of segmented streams]"
exit 1;
fi
@svagionitis
svagionitis / copy-wic-rootfs.sh
Created May 13, 2020 14:57
This script mounts the rootfs partition of a wic.xz image and copy the rootfs to a directory. The roofs partition is at partition 3.
#!/bin/sh -eu
# shellcheck shell=ash
# This script mounts the rootfs partition of a wic.xz image and copy the rootfs
# to a directory. The roofs partition is at partition 3.
if ! command -v losetup > /dev/null ; then
echo "ERROR: losetup is missing" >&2
exit 1
fi
@svagionitis
svagionitis / Makefile
Last active November 21, 2023 07:45
This small utility shows how to use the `getifaddrs` and get information for network interfaces.
all: get-network-interfaces get-gateway-ip
get-network-interfaces: get-network-interfaces.c
gcc -o get-network-interfaces -ggdb -O1 -Wall -W -ansi -pedantic -std=gnu99 get-network-interfaces.c
get-gateway-ip: get-gateway-ip.c
gcc -o get-gateway-ip -ggdb -O1 -Wall -W -ansi -pedantic -std=gnu99 get-gateway-ip.c
clean:
rm -rf get-network-interfaces
@svagionitis
svagionitis / object_tracking.cpp
Last active February 10, 2022 15:28
Object tracking algorithms for OpenCV 4.5.5
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
// Examples from peopledetect.cpp and from https://learnopencv.com/object-tracking-using-opencv-cpp-python/
#include <opencv2/objdetect.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
@svagionitis
svagionitis / git-fetch-all-dir-recursively.sh
Created September 8, 2021 06:44
Git fetch git repos in directories recursively
#!/bin/sh -eu
# Git fetch git repos in directories recursively
usage()
{
echo "Usage: $0 <directory>"
}
if [ -z "${1}" ]; then
usage
@svagionitis
svagionitis / webscraping-requests-beautifulsoup.py
Last active February 2, 2021 18:17
An example of webscraping in Python with requests an BeuatifulSoup
"""
An example of webscraping in Python with requests an BeuatifulSoup
Scraping lab test data from https://labtestsonline.org.uk/tests-index
This script will get a list of the lab tests from the above link and then get
more information for each test following the appropriate link. The web page stores
the data in Drupal 8. The lab tests are saved in JSON files.
"""
@svagionitis
svagionitis / backup-dir.sh
Created January 16, 2021 18:32
A script to backup a directory
#!/bin/sh -eu
# A script to backup a directory
usage() {
cat << EOF
Usage: $(basename "$0") [-d directory]
Where:
-d The directory to backup.
-h This help
@svagionitis
svagionitis / .gitignore
Last active January 11, 2021 16:58
A websocket proxy example in python
## https://github.com/github/gitignore/blob/master/Global/Vim.gitignore
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
/*The index Base64 table.*/
static const unsigned char indexBase64Tbl[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";