Skip to content

Commit

Permalink
balmora-september
Browse files Browse the repository at this point in the history
  • Loading branch information
tox2ik committed Sep 21, 2021
1 parent 3b1b5fd commit 8c147e1
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 111 deletions.
14 changes: 7 additions & 7 deletions cache-files
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash


#find ~ -path '*chrome*' -name Cache -print -type d
#find ~ -path '*chrome*' -name Cache -print -type d
find ~ \
'(' \
-path '*chrome*' \
Expand All @@ -13,14 +13,14 @@ find ~ \
-or -name IndexedDB \
-or -name 'Service Worker' \
')' \
-print -type d
-print -type d


#find ~ -path '*chrome*' -name IndexedDB -print -type d
#find ~ -path '*chromium*' -name IndexedDB -print -type d
#find ~ -path '*chrome*' -name 'Service Worker' -print -type d
#find ~ -path '*chromium*' -name 'Service Worker' -print -type d

#find ~ -path '*chrome*' -name IndexedDB -print -type d
#find ~ -path '*chromium*' -name IndexedDB -print -type d
#find ~ -path '*chrome*' -name 'Service Worker' -print -type d
#find ~ -path '*chromium*' -name 'Service Worker' -print -type d
#()| xargs -0 -I% du -sm "%"

#{
Expand Down
76 changes: 38 additions & 38 deletions lssort
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#!/bin/bash

# what?
# lists files after folders like windoze explorer
# this is somewhat obsolete with a recent version of coreutils as ls now
# supports --group-directories-first
#
#
# bugs:
# lssort lists files in a folder in a structured way, usually
# taking less space for the output than normal ls would.
#
# - list dirs starting with _ first
# then dirs
# then files
# then symlinks and other stuff
#
# - lists files after folders like windoze explorer
# now also possible with: ls --group-directories-first
#
# bugs:
# - <> in filename
# - device files are missing
#
#
# files named e.g -l (valid parameters)


#

function trim {
local var="$@"
Expand Down Expand Up @@ -43,21 +47,14 @@ function arrayContains {
return 0
}

# d dir f file p named pipe (FIFO) l sylink s socket D door (Solaris)
# d dir f file p named pipe (FIFO) l sylink s socket D door (Solaris)
# c character (unbuffered) special b block (buffered) special

function finddirs {
# mindepth 1 excludes the . directory
$FIND "$@" \
-mindepth 1 -maxdepth 1 -depth -type d \
-printf '%f\0'
}

function findfiles {
$FIND "$@" \
-maxdepth 1 -depth -type f \
-printf "%f\0"
}
# mindepth 1 excludes the . directory
# -depth causes depth-first traversal
function finddirs_ { $FIND "$@" -mindepth 1 -maxdepth 1 -depth -type d -name '_*' -printf '%f\0'; }
function finddirs { $FIND "$@" -mindepth 1 -maxdepth 1 -depth -type d -not -name '_*' -printf '%f\0'; }
function findfiles { $FIND "$@" -maxdepth 1 -depth -type f -printf '%f\0'; }

function findspecials {
$FIND "$@" \
Expand All @@ -67,7 +64,7 @@ function findspecials {

# bug: ls -[aA] will never work
function filter_out_hidden {
$GREP -zv '^\..*'
$GREP -zv '^\..*'
}

##
Expand All @@ -79,33 +76,35 @@ FPATHS=""
LSSWITCHES=""


LS=/bin/ls\ --color=auto
GREP=/bin/grep
LS=ls\ --color=auto
GREP=grep
FIND=/usr/bin/find

type /usr/bin/grep &>/dev/null && GREP=/usr/bin/grep
type /usr/bin/ls &>/dev/null && LS=/usr/bin/ls\ --color=auto
type /usr/bin/ls &>/dev/null && LS=/usr/bin/ls\ --color=auto

FIND=/usr/bin/find
GNUBIN=/Users/jaroslav/opt/grep/libexec/gnubin

if [ -f $GNUBIN/ls ]; then LS=$GNUBIN/ls; fi
if [ -f $GNUBIN/ls ]; then LS=$GNUBIN/ls; fi
if [ -f $GNUBIN/grep ]; then GREP=$GNUBIN/grep; fi
if [ -f $GNUBIN/find ]; then FIND=$GNUBIN/find; fi

ARG=$1
ARGC=0
while [ "$ARG" != "" ];
do
if [ `arrayContains validswitches[@] $ARG ;echo $?` -eq 0 ];then
LSSWITCHES="${LSSWITCHES} $ARG"
if arrayContains validswitches[@] $ARG;
then
LSSWITCHES="$LSSWITCHES $ARG"
unset ARG
fi

if [ -d "$ARG" ];then
#PATHS="${PATHS} $ARG"
PATHS[${ARGC}]=$ARG
PATHS[$ARGC]=$ARG
let ARGC=ARGC+1
else
FPATHS="${FPATHS}\0$ARG"
FPATHS="$FPATHS\0$ARG"
fi
shift
ARG=$1
Expand All @@ -114,14 +113,14 @@ done
#PATHS=`trim $PATHS`
FPATHS=`trim "$FPATHS"`

if [ ${#FPATHS} -eq 0 ]; then
if [ ${#FPATHS} -eq 0 ]; then
if [ ${#PATHS[@]} -eq 0 ]; then
PATHS=(".")
fi
fi
for arg in "${PATHS[@]}";
do
if [[ ${#arg} -eq 1 && "$arg" == "/" ]];then
if [[ ${#arg} -eq 1 && "$arg" == "/" ]];then
p=/
else
#p=${arg%%/}
Expand All @@ -131,14 +130,15 @@ do
( cd "$p"

if [[ "$p" != "." && "$p" != "./" ]];then echo "$p": ;fi
finddirs_ | filter_out_hidden | xargs -r0 $LS $LSSWITCHES -d --
finddirs | filter_out_hidden | xargs -r0 $LS $LSSWITCHES -d --
findfiles | filter_out_hidden | xargs -r0 $LS $LSSWITCHES --
findfiles | filter_out_hidden | xargs -r0 $LS $LSSWITCHES --
findspecials | filter_out_hidden | xargs -r0 $LS $LSSWITCHES -d --
[ ${#PATHS[@]} -gt 1 ] && echo
)
done

if [ -n "$FPATHS" ]; then
echo -ne "$FPATHS\0" | xargs -0 -r $LS $LSSWITCHES --
fi
fi

47 changes: 47 additions & 0 deletions openssl-check-https.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/awk

BEGIN {
cert=0
buf[0]=""
cert_line=0
}


/BEGIN/ {
print ""
}
cert_line == 0 {
print
}

/(-----)?BEGIN CERTIFICATE(-----)?/ || cert_line >= 1 {
if (cert_line == 0) {
cert_line=1
}

buf[cert_line]=$0
cert_line++

}
/(-----)?END CERTIFICATE(-----)?/ {


o=""
for (i in buf) {
# print buf[i], i
o=o "\n" buf[i]
}

f= "/tmp/examine-cert-" cert ".crt"

print o > f
print "-----WRITTEN TO: " f

for (i in buf) {
buf[i]=""
}

cert_line=0
cert++
}

6 changes: 3 additions & 3 deletions ps-mem
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi


function bm() {
ps -e -o %mem,vsz,rss,comm --no-headers |
ps -e -o %mem,vsz,rss,comm --no-headers |
sort -b -k3,3n -k4,20
}

Expand All @@ -30,10 +30,10 @@ bm | s_ | awk -F@ '
pp[$4]++
}
END {
END {
for (i in _) {
print int(_[i]/1024) , i "(" pp[i] ")", int(_[i]/pp[i]/1024)
}
}
}' | sort -k 1,1nr | head -n 30


Expand Down
Loading

0 comments on commit 8c147e1

Please sign in to comment.