{ exename=$(python3) exename=${exename%%?} || exit; } <<\EOF
import os, sys
try:
fd = os.open(os.path.join(b"/proc", os.fsencode(str(os.getppid())), b"exe"), os.O_PATH | os.O_NOFOLLOW)
sys.stdout.buffer.write(os.path.basename(os.readlink(b"", dir_fd = fd)).__add__(b"\x01"))
except: sys.exit(1)
finally: os.close(fd)
EOF
case $exename in
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 | |
| shopt -s lastpipe extglob expand_aliases | |
| typeset -gx BASH_COMPAT=51 | |
| function unset2 { | |
| command unset "$@" | |
| } | |
| function nonlocal_alias { | |
| typeset s=0 |
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
| # unexport and unset all instances of named variable arguments. | |
| # `unsetall` cannot tolerate `att_invisible | att_nameref`. Passing one will cause unpredictable failure. | |
| function unsetall { | |
| if [[ ${FUNCNAME[0]} != "${FUNCNAME[1]}" ]]; then | |
| typeset -a z | |
| for z do | |
| [[ $z == z ]] || | |
| z+=("$z") | |
| done | |
| if (( ${#z[@]} - 1 < $# )); then |
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
| #define _GNU_SOURCE | |
| #include <dlfcn.h> | |
| #include <errno.h> | |
| #include <pthread.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <sys/utsname.h> | |
| typedef int (*uname_fn_t)(struct utsname*); |
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
| $ time ( echo; bash /proc/self/fd/9 9<<\_EOF 8<<\_EOF ) | |
| shopt -s lastpipe | |
| { | |
| pipesz -n 1 | |
| pipesz -gn 3 3<&1 1<&2; | |
| head -c "$(( 4 * 2 ** 31 ))" </dev/urandom | |
| } | len=${ python3 /proc/self/fd/8 "${| ${ exec {REPLY}<&1; }; }"; } fd=$_ || exit # Inner assignment to `REPLY` falls through to ${|; } | |
| printf 'bytes copied: %d\n' "$len" | |
| lsfd -p "$BASHPID" -Q "FD==${fd}" -o +flags,pos,size | |
| exec {fd}<&- |
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
| ~ $ { readlink -zf /proc/self/fd/0 | IFS= read -rd '' c; python -c 'import sys,os;from ctypes import*;CFUNCTYPE(c_int,c_int,POINTER(c_char_p),POINTER(c_char_p),use_errno=True)(CDLL(None).fexecve)(int(sys.argv[1]),*[(c_char_p*(len(t:=tuple(x))+1))(*t,None)for x in((os.fsencode(a)for a in sys.argv[2:]),(b"=".join(kv)for kv in os.environb.items()))])' 0 "${c##*/}" hello world; } <${BASH_CMDS[echo]:-${| enable -n echo; hash echo; enable echo; REPLY=${BASH_CMDS[echo]}; }} | |
| hello world |
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
| # grub.cfg | |
| function loadModules { | |
| insmod regexp | |
| for x in "$@"; do | |
| if regexp -s 1:y '([^/]+)\.mod$' "$x"; then | |
| if regexp 'test|^tpm$|^regexp$|^[uoea]hci|^gcry_' "$y"; then | |
| continue | |
| else | |
| insmod "$y" |
#!/usr/bin/python3
import os
import shutil
import logging
from pathlib import Path
from typing import Iterable
logging.basicConfig(level=logging.INFO, format="%(message)s")
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 ksh | |
| function chanStats { | |
| nameref ret=$1 | |
| typeset -T ChanStats=( | |
| logdir=~/.weechat/logs | |
| typeset logfile channel network | |
| typeset -a stats |
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
| ProxyUseFdpass yes | |
| ProxyCommand python3 -c 'import socket,sys,struct; s=socket.create_connection((sys.argv[1],int(sys.argv[2]))); socket.fromfd(1,socket.AF_UNIX,socket.SOCK_STREAM).sendmsg([b"\0"],[(socket.SOL_SOCKET,socket.SCM_RIGHTS,struct.pack("i",s.fileno()))])' %h %p |
NewerOlder