diff options
author | terminaldweller <thabogre@gmail.com> | 2022-03-24 21:26:54 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-03-24 21:26:54 +0000 |
commit | a2c685f04294da1da671bfb378514b12f8532c97 (patch) | |
tree | c39923a7f883cc0b4a478251b2cb3f6407e746e5 | |
parent | irssi config (diff) | |
download | scripts-a2c685f04294da1da671bfb378514b12f8532c97.tar.gz scripts-a2c685f04294da1da671bfb378514b12f8532c97.zip |
scotch now leaves normal data alone. added battery to tmux.
-rw-r--r-- | .zshrc | 1 | ||||
-rwxr-xr-x | bin/scotch | 500 | ||||
-rw-r--r-- | sh/lib.sh | 28 | ||||
-rwxr-xr-x | tmux/date.sh | 7 |
4 files changed, 521 insertions, 15 deletions
@@ -160,6 +160,7 @@ alias socks5ir="autossh -M 0 -N -D 9997 -o ServerAliveInterval=180 -o ServerAliv alias socks5vpn1="autossh -M 0 -N -D 9999 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l rooot 145.239.165.137" alias socks5vpn2="autossh -M 0 -N -D 9996 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l rooot -p 1022 192.99.102.52" alias socks5vpn3="autossh -M 0 -N -D 9995 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l root -p 2022 185.112.147.110" +alias socks5vpn4="autossh -M 0 -N -D 9994 -o ServerAliveInterval=180 -o ServerAliveCountMax=3 -o ExitOnForwardFailure=yes -l ubuntu -p 1022 130.185.121.80" alias cloud_one="ssh 130.185.121.80 -l ubuntu -p 1022" alias zharf_server="zssh 192.168.12.5 -l farzad" alias k9sskin="vim ~/scripts/.k9s/skin.yml" @@ -4,6 +4,478 @@ import sys import subprocess +syscall_set = set( + [ + "_llseek", + "_newselect", + "_sysctl", + "accept", + "accept4", + "access", + "acct", + "add_key", + "adjtimex", + "alarm", + "alloc_hugepages", + "arc_gettls", + "arc_settls", + "arc_usr_cmpxchg", + "arch_prctl", + "atomic_barrier", + "atomic_cmpxchg_32", + "bdflush", + "bind", + "bpf", + "brk", + "breakpoint", + "cacheflush", + "capget", + "capset", + "chdir", + "chmod", + "chown", + "chown32", + "chroot", + "clock_adjtime", + "clock_getres", + "clock_gettime", + "clock_nanosleep", + "clock_settime", + "clone2", + "clone", + "clone3", + "close", + "close_range", + "connect", + "copy_file_range", + "creat", + "create_module", + "delete_module", + "dup", + "dup2", + "dup3", + "epoll_create", + "epoll_create1", + "epoll_ctl", + "epoll_pwait", + "epoll_pwait2", + "epoll_wait", + "eventfd", + "eventfd2", + "execv", + "execve", + "execveat", + "exit", + "exit_group", + "faccessat", + "faccessat2", + "fadvise64", + "fadvise64_64", + "fallocate", + "fanotify_init", + "fanotify_mark", + "fchdir", + "fchmod", + "fchmodat", + "fchown", + "fchown32", + "fchownat", + "fcntl", + "fcntl64", + "fdatasync", + "fgetxattr", + "finit_module", + "flistxattr", + "flock", + "fork", + "free_hugepages", + "fremovexattr", + "fsconfig", + "fsetxattr", + "fsmount", + "fsopen", + "fspick", + "fstat", + "fstat64", + "fstatat64", + "fstatfs", + "fstatfs64", + "fsync", + "ftruncate", + "ftruncate64", + "futex", + "futimesat", + "get_kernel_syms", + "get_mempolicy", + "get_robust_list", + "get_thread_area", + "get_tls", + "getcpu", + "getcwd", + "getdents", + "getdents64", + "getdomainname", + "getdtablesize", + "getegid", + "getegid32", + "geteuid", + "geteuid32", + "getgid", + "getgid32", + "getgroups", + "getgroups32", + "gethostname", + "getitimer", + "getpeername", + "getpagesize", + "getpgid", + "getpgrp", + "getpid", + "getppid", + "getpriority", + "getrandom", + "getresgid", + "getresgid32", + "getresuid", + "getresuid32", + "getrlimit", + "getrusage", + "getsid", + "getsockname", + "getsockopt", + "gettid", + "gettimeofday", + "getuid", + "getuid32", + "getunwind", + "getxattr", + "getxgid", + "getxpid", + "getxuid", + "init_module", + "inotify_add_watch", + "inotify_init", + "inotify_init1", + "inotify_rm_watch", + "io_cancel", + "io_destroy", + "io_getevents", + "io_pgetevents", + "io_setup", + "io_submit", + "io_uring_enter", + "io_uring_register", + "io_uring_setup", + "ioctl", + "ioperm", + "iopl", + "ioprio_get", + "ioprio_set", + "ipc", + "kcmp", + "kern_features", + "kexec_file_load", + "kexec_load", + "keyctl", + "kill", + "landlock_add_rule", + "landlock_create_ruleset", + "landlock_restrict_self", + "landlock_add_rule", + "lchown", + "lchown32", + "lgetxattr", + "link", + "linkat", + "listen", + "listxattr", + "llistxattr", + "lookup_dcookie", + "lremovexattr", + "lseek", + "lsetxattr", + "lstat", + "lstat64", + "madvise", + "mbind", + "memory_ordering", + "membarrier", + "memfd_create", + "migrate_pages", + "mincore", + "mkdir", + "mkdirat", + "mknod", + "mknodat", + "mlock", + "mlock2", + "mlockall", + "mmap", + "mmap2", + "modify_ldt", + "mount", + "move_mount", + "move_pages", + "mprotect", + "mq_getsetattr", + "mq_notify", + "mq_open", + "mq_timedreceive", + "mq_timedsend", + "mq_unlink", + "mremap", + "msgctl", + "msgget", + "msgrcv", + "msgsnd", + "msync", + "munlock", + "munlockall", + "munmap", + "name_to_handle_at", + "nanosleep", + "newfstatat", + "nfsservctl", + "nice", + "old_adjtimex", + "old_getrlimit", + "oldfstat", + "oldlstat", + "oldolduname", + "oldstat", + "oldumount", + "olduname", + "open", + "open_by_handle_at", + "open_tree", + "openat", + "openat2", + "or1k_atomic", + "pause", + "pciconfig_iobase", + "pciconfig_read", + "pciconfig_write", + "perf_event_open", + "personality", + "perfctr", + "perfmonctl", + "pidfd_getfd", + "pidfd_send_signal", + "pidfd_open", + "pipe", + "pipe2", + "pivot_root", + "pkey_alloc", + "pkey_free", + "pkey_mprotect", + "poll", + "ppoll", + "prctl", + "pread64", + "preadv", + "preadv2", + "prlimit64", + "process_madvise", + "process_vm_readv", + "process_vm_writev", + "pselect6", + "ptrace", + "pwrite64", + "pwritev", + "pwritev2", + "query_module", + "quotactl", + "quotactl_fd", + "read", + "readahead", + "readdir", + "readlink", + "readlinkat", + "readv", + "reboot", + "recv", + "recvfrom", + "recvmsg", + "recvmmsg", + "remap_file_pages", + "removexattr", + "rename", + "renameat", + "renameat2", + "request_key", + "restart_syscall", + "riscv_flush_icache", + "rmdir", + "rseq", + "rt_sigaction", + "rt_sigpending", + "rt_sigprocmask", + "rt_sigqueueinfo", + "rt_sigreturn", + "rt_sigsuspend", + "rt_sigtimedwait", + "rt_tgsigqueueinfo", + "rtas", + "s390_runtime_instr", + "s390_pci_mmio_read", + "s390_pci_mmio_write", + "s390_sthyi", + "s390_guarded_storage", + "sched_get_affinity", + "sched_get_priority_max", + "sched_get_priority_min", + "sched_getaffinity", + "sched_getattr", + "sched_getparam", + "sched_getscheduler", + "sched_rr_get_interval", + "sched_set_affinity", + "sched_setaffinity", + "sched_setattr", + "sched_setparam", + "sched_setscheduler", + "sched_yield", + "seccomp", + "select", + "semctl", + "semget", + "semop", + "semtimedop", + "send", + "sendfile", + "sendfile64", + "sendmmsg", + "sendmsg", + "sendto", + "set_mempolicy", + "set_robust_list", + "set_thread_area", + "set_tid_address", + "set_tls", + "setdomainname", + "setfsgid", + "setfsgid32", + "setfsuid", + "setfsuid32", + "setgid", + "setgid32", + "setgroups", + "setgroups32", + "sethae", + "sethostname", + "setitimer", + "setns", + "setpgid", + "setpgrp", + "setpriority", + "setregid", + "setregid32", + "setresgid", + "setresgid32", + "setresuid", + "setresuid32", + "setreuid", + "setreuid32", + "setrlimit", + "setsid", + "setsockopt", + "settimeofday", + "setuid", + "setuid32", + "setup", + "setxattr", + "sgetmask", + "shmat", + "shmctl", + "shmdt", + "shmget", + "shutdown", + "sigaction", + "sigaltstack", + "signal", + "signalfd", + "signalfd4", + "sigpending", + "sigprocmask", + "sigreturn", + "sigsuspend", + "socket", + "socketcall", + "socketpair", + "spill", + "splice", + "spu_create", + "spu_run", + "ssetmask", + "stat", + "stat64", + "statfs", + "statfs64", + "statx", + "stime", + "subpage_prot", + "swapcontext", + "switch_endian", + "swapoff", + "swapon", + "symlink", + "symlinkat", + "sync", + "sync_file_range", + "sync_file_range2", + "syncfs", + "sys_debug_setcontext", + "syscall", + "sysfs", + "sysinfo", + "syslog", + "sysmips", + "tee", + "tgkill", + "time", + "timer_create", + "timer_delete", + "timer_getoverrun", + "timer_gettime", + "timer_settime", + "timerfd_create", + "timerfd_gettime", + "timerfd_settime", + "times", + "tkill", + "truncate", + "truncate64", + "ugetrlimit", + "umask", + "umount", + "umount2", + "uname", + "unlink", + "unlinkat", + "unshare", + "uselib", + "ustat", + "userfaultfd", + "usr26", + "usr32", + "utime", + "utimensat", + "utimes", + "utrap_install", + "vfork", + "vhangup", + "vm86old", + "vm86", + "vmsplice", + "wait4", + "waitid", + "waitpid", + "write", + "writev", + "xtensa", + ] +) + class Color: bold = "\033[1m" @@ -51,18 +523,22 @@ def main(): end_line = lines[-2] lines = lines[:-2] for line in lines: - syscall = line[0 : line.find("(")] - sysargs = line[line.find("(") + 1 : line.find(")")].split() - exitvalue = line[line.find(")") + 1 :] - print(Color.one + syscall, end=" ") - print(Color.two, end=" ") - sysargs = list(filter(None, sysargs)) - for arg in sysargs: - if arg.find("|") > 0: - print(Color.five, arg, end=" ") - else: - print(arg, end=" ") - print(Color.three + exitvalue + Color.reset) + if line[0 : line.find("(")] in syscall_set: + syscall = line[0 : line.find("(")] + sysargs = line[line.find("(") + 1 : line.find(")")].split() + exitvalue = line[line.find(")") + 1 :] + print(Color.one + syscall, end=" ") + print(Color.two, end=" ") + sysargs = list(filter(None, sysargs)) + for arg in sysargs: + if arg.find("|") > 0: + print(Color.five, arg, end=" ") + else: + print(arg, end=" ") + print(Color.three + exitvalue + Color.reset) + else: + # leave regular stdout/stderr alone. we only want syscalls + print(line) print(Color.reset + Color.bold + Color.nine + end_line + Color.reset) @@ -53,3 +53,31 @@ copy_pam_mod_deps() { copy_to_stash $MOD_ABS "$DEP_LIST" $2 $3 done } + +dig() { + globalholecounter=0 + if test "$("ls" -A "/home/devi/devi/abbatoir")"; then + while [ 1 ]; do + if [ -d "/home/devi/devi/abbatoir/hole$globalholecounter" ]; then + # if its not empty + if test "$("ls" -A "/home/devi/devi/abbatoir/hole$globalholecounter")"; then + : + # if its empty + else + cd /home/devi/devi/abbatoir/hole$globalholecounter + break + fi + else + mkdir /home/devi/devi/abbatoir/hole$globalholecounter + cd /home/devi/devi/abbatoir/hole$globalholecounter + echo $globalholecounter + break + fi + $((globalholecounter=globalholecounter+1)) + done + else + mkdir /home/devi/devi/abbatoir + mkdir /home/devi/devi/abbatoir/hole$globalholecounter + cd /home/devi/devi/abbatoir/hole$globalholecounter + fi +} diff --git a/tmux/date.sh b/tmux/date.sh index 032de24..f8ce7c4 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -15,14 +15,15 @@ UTC_TIME="#[fg=colour255 bg=colour25]"$(echo GMT: $UTC_TIME_RESULT) JDATE="#[fg=colour255 bg=colour29]"$(jdate | gawk '{print $2" "$3}') # OPENWEATHERMAP_TOKEN=$(cat /home/devi/scripts/tmux/openweathermap.json|jq -r ".token") # WEATHER_INFO=$(sleep 120 && torsocks curl "https://api.openweathermap.org/data/2.5/weather?q=Tehran&appid=$OPENWEATHERMAP_TOKEN&units=metric"|jq ".main.temp") -WEATHER_INFO=$(curl 'wttr.in/tehran?T&format=%t/%f') +WEATHER_INFO=$(curl 'wttr.in/tehran?T&format=%f') WEATHER="#[fg=colour255 bg=colour32]"$(echo $WEATHER_INFO) CPU_TEMP=$(sensors | grep temp1 | head -n 1 | awk '{print $2}') CPU_SECTION="#[fg=colour36 bg=colour16]$SEPARATOR_LEFT_BOLD#[fg=colour16 bg=colour36]$CPU_TEMP" +BATTERY=$(upower -i $(upower -e | grep 'BAT') | grep -E "percentage" | awk '{print $2}') -# echo "$CPU_SECTION#[fg=colour32 bg=colour36]$SEPARATOR_LEFT_BOLD$WEATHER#[fg=colour29 bg=colour32]$SEPARATOR_LEFT_BOLD$JDATE #[fg=colour31 bg=colour29]$SEPARATOR_LEFT_BOLD$DAY $SEPARATOR_LEFT_THIN $DATE $SEPARATOR_LEFT_THIN $TIME #[fg=colour25 bg=colour31]$SEPARATOR_LEFT_BOLD$UTC_TIME " echo "$CPU_SECTION#[fg=colour32 bg=colour36]\ $SEPARATOR_LEFT_BOLD$WEATHER#[fg=colour29 bg=colour32]\ $SEPARATOR_LEFT_BOLD$JDATE #[fg=colour31 bg=colour29]\ -$SEPARATOR_LEFT_BOLD$DAY $SEPARATOR_LEFT_THIN $DATE $SEPARATOR_LEFT_THIN $TIME #[fg=colour25 bg=colour31]\ +$SEPARATOR_LEFT_BOLD$DAY $SEPARATOR_LEFT_THIN $DATE $SEPARATOR_LEFT_THIN $TIME #[fg=colour214 bg=colour31]\ +$SEPARATOR_LEFT_BOLD#[fg=colour0 bg=colour214]$BATTERY #[fg=colour25 bg=colour214]\ $SEPARATOR_LEFT_BOLD$UTC_TIME " |