This file contains hidden or 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
local fileObj = get_input_files()[1] | |
if (fileObj == nil or not is_file(fileObj) ) then | |
abort("No file name was provided") | |
end | |
local fileMeta = meta_data(fileObj) | |
if ( not string.find(fileMeta.mimetype, "image/") ) then | |
abort("File ".. fileObj.name .. " is not an image (mimetype:" .. fileMeta.mimetype ..")") | |
end |
This file contains hidden or 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 <linux/if_ether.h> | |
#include <linux/bpf.h> | |
#include <arpa/inet.h> | |
#define SEC(NAME) __attribute__((section(NAME), used)) | |
SEC("xdpdropcafe") | |
int xdp_dropcafe(struct xdp_md *xdp) { | |
void *data_end = (void *)(long)xdp->data_end; | |
void *data = (void *)(long)xdp->data; |
This file contains hidden or 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 sh | |
set -u | |
export LC_ALL=C | |
# Reexec'ing myself as root | |
if [[ "$(id -u)" != "0" ]]; then | |
# Check with sudo | |
if ! [[ -r /dev/ipmi0 ]] && ! type -P sudo >/dev/null; then | |
echo >&2 "You need sudo to reexec this script as root for ipmi access" |
This file contains hidden or 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 bash | |
set -o nounset -o noclobber | |
export LC_ALL=C | |
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PATH" | |
export PS4=' (${BASH_SOURCE##*/}:$LINENO ${FUNCNAME[0]:-main}) ' | |
function getParent { | |
typeset pid="$1" | |
awk '$1 == "PPid:"{ print $2}' /proc/$pid/status |
This file contains hidden or 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
# Some placeholders | |
typeset -i _BASHEXEC_PREEXECTIME=0 | |
typeset _BASHEXEC_PREEXECCMD="" | |
function bashexec_post { | |
# Don't display anything if we didn't ran anything | |
if [[ -n "$_BASHEXEC_PREEXECCMD" ]]; then | |
echo "Took $((${SECONDS:-$(date +%s)} - $_BASHEXEC_PREEXECTIME ))s to run '$_BASHEXEC_PREEXECCMD'" | |
fi |
This file contains hidden or 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
LD_LIBRARY_PATH='$LIB' ./elf/ldconfig -p | |
(gdb) info stack | |
#0 0x000000000049032b in expand_dynamic_string_token (l=0x0, input=0x7ffe35525c60 "$LIB") at dl-load.c:400 | |
#1 0x0000000000490442 in fillin_rpath (rpath=<optimized out>, rpath@entry=0x7ffe35525c60 "$LIB", result=0x14c65e0, sep=sep@entry=0x4c5f10 ":;", what=what@entry=0x4b1ac9 "LD_LIBRARY_PATH", | |
where=where@entry=0x0, l=l@entry=0x0) at dl-load.c:465 | |
#2 0x000000000049094f in _dl_init_paths (llp=<optimized out>, source=0x4b1ac9 "LD_LIBRARY_PATH", glibc_hwcaps_prepend=<optimized out>, glibc_hwcaps_mask=<optimized out>) at dl-load.c:825 | |
#3 0x00000000004648e2 in _dl_non_dynamic_init () at dl-support.c:344 | |
#4 0x0000000000465b96 in __libc_init_first (argc=2, argv=0x7ffe35525f58, envp=0x7ffe35525f70) at init-first.c:68 |
This file contains hidden or 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
function args2csv { | |
typeset -a fields=("$@") | |
# Escape existing quotes | |
fields=("${fields[@]//\"/\"\"}"); | |
# Add " before and after fields | |
fields=("${fields[@]/#/\"}") |
This file contains hidden or 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 bash | |
# Get min/max port range from sysctl | |
prange="$(sysctl net.ipv4.ip_local_port_range| awk '{print $3,$4}')" | |
pmin="${prange% *}" | |
pmax="${prange#* }" | |
# TODO: ignore ports in sysctl net.ipv4.ip_local_reserved_ports | |
ss --listen --numeric --tcp --process | awk -v pmin=$pmin -v pmax=$pmax ' |
This file contains hidden or 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
# Override RM to protect critical folders. Regex | |
typeset -gxa MYS_RM_PROTECT=( | |
"$HOME/[^/]+" | |
"/root/.+" | |
) | |
# TODO: 2 unhandled cases: | |
# - protected path contains a symlink | |
# - recursive parent deletion | |
function rm { | |
typeset todel= safedir= confirmdir="" |
This file contains hidden or 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 bash | |
set -o nounset | |
set -o noclobber | |
export LC_ALL=C | |
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$PATH" | |
readonly MYSELF="$(readlink -f $0)" | |
readonly MYPATH="${MYSELF%/*}" |
NewerOlder