Skip to content

Instantly share code, notes, and snippets.

@NikolasK-source
NikolasK-source / tohevc.sh
Created February 16, 2024 22:11
ffmpeg wrapper to convert video files to hevc codec with an AMD GPU
#!/bin/bash
# ffmpeg wrapper to convert video files to hevc codec with an AMD GPU.
# usage: tohevc input output
# MIT License
#
# Copyright (c) 2024 Nikolas Koesling <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@NikolasK-source
NikolasK-source / toopus.sh
Created February 16, 2024 22:09
ffmpeg wrapper to convert audio files to opus codec
#!/bin/bash
# ffmpeg wrapper to convert audio files to opus codec
# usage: tohevc input output
# MIT License
#
# Copyright (c) 2024 Nikolas Koesling <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@NikolasK-source
NikolasK-source / split_string.hpp
Last active November 22, 2023 19:13
C++ split string
/*
* MIT License
*
* Copyright (c) 2023 Nikolas Koesling <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
alias dshm="dump-shm"
alias mbsig="shm-modbus-signal-gen"
alias mbtcp="modbus-tcp-client-shm"
alias mbrtu="modbus-rtu-client-shm"
alias shmrnd="shared-mem-random"
alias stdin2mb="stdin-to-modbus-shm"
alias wagomb="wago-modbus-coupler-shm"
alias wshm="write-shm"
@NikolasK-source
NikolasK-source / rpgrep.py
Created September 1, 2023 06:29
Wrapper to simplify recursive grep with a pearl regex expression in the current working directory
#!/usr/bin/python
#
# Wrapper to simplify a recursive grep with a pearl compatible regular expression
#
# MIT License
#
# Copyright (c) 2023 Nikolas Koesling <[email protected]>
#
@NikolasK-source
NikolasK-source / shm-modbus-signal-generator.py
Created June 28, 2023 08:19
System time based signal generator for stdin-to-modbus-shm
#!/usr/bin/python3
# MIT License
#
# Copyright (c) 2023 Nikolas Koesling <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@NikolasK-source
NikolasK-source / dshm
Last active October 23, 2023 06:57
network.koesling.shm-modbus launcher scripts (shorter commands)
#!/bin/bash
trap "" INT TERM QUIT
flatpak run network.koesling.shm-modbus dump-shm $@
ret=$?
if [ $ret -gt 128 ]; then
exit 0
fi
exit $ret
@NikolasK-source
NikolasK-source / dump-shm
Last active October 23, 2023 06:56
network.koesling.shm-modbus launcher scripts
#!/bin/bash
trap "" INT TERM QUIT
flatpak run network.koesling.shm-modbus dump-shm $@
ret=$?
if [ $ret -gt 128 ]; then
exit 0
fi
exit $ret
@NikolasK-source
NikolasK-source / endian.hpp
Last active July 7, 2024 07:53
C++ header to handle endianness (C++17)
/*
* Copyright (C) 2022 Nikolas Koesling <[email protected]>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
* Software.
@NikolasK-source
NikolasK-source / RandomString.hpp
Last active December 28, 2020 12:21
C++ "random" string
#pragma once
#include <random>
#include <string>
#include <ctime>
namespace RandomString {
static constexpr const char* DEFAULT_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static std::default_random_engine random{static_cast<unsigned>(time(0))};