Renaming package to ShadowArch to follow /wiki/Design_Principles; improved packing; development sync to current state -- massive overhaul
This commit is contained in:
25
UserScripts/Makefile
Normal file
25
UserScripts/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all failcount logged-shell standardize-folder sysinfo whatismyip worktrack
|
||||
LOCATION=${pkgdir}/usr/local/bin
|
||||
PERMISSION=0755
|
||||
compile:
|
||||
@echo Nothing to compile.
|
||||
|
||||
install: compile
|
||||
mkdir -p ${LOCATION}
|
||||
for i in ${LIST}; do cp ./$$i ${LOCATION}; done
|
||||
make checkperm
|
||||
|
||||
reverse:
|
||||
for i in ${LIST}; do cp ${LOCATION}/$$i .; done
|
||||
|
||||
test: ${LIST}
|
||||
for i in ${LIST}; do [ "$$(grep -c '#/bin/bash' $$i)" -ne 1 ]; done
|
||||
|
||||
checkperm:
|
||||
for i in ${LIST}; do chown root:root ${LOCATION}/$$i; chmod ${PERMISSION} ${LOCATION}/$$i; done
|
||||
|
||||
clean:
|
||||
@echo Nothing to do.
|
||||
|
||||
diff:
|
||||
for i in ${LIST}; do diff ./$$i ${LOCATION}/$$i; done
|
2
UserScripts/bell
Executable file
2
UserScripts/bell
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
echo -ne '\007'
|
3
UserScripts/bigorlittle
Executable file
3
UserScripts/bigorlittle
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
if [ $(echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6) ]; then echo "Little endian"; else echo "Big endian"; fi
|
||||
|
3
UserScripts/compare-directories
Executable file
3
UserScripts/compare-directories
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
if [ "$1" == "" -or "$2" == "" ]; then echo Need to supply two directories as arguments.; exit; fi;
|
||||
diff -rcw "$1" "$2" | grep ^Only
|
12
UserScripts/compress-all
Executable file
12
UserScripts/compress-all
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
export IFS="
|
||||
"
|
||||
|
||||
for i in $(find "$PWD" -type d); do
|
||||
cd "$i";
|
||||
for j in $(find . -maxdepth 1 -type f); do
|
||||
echo $i/$j
|
||||
gzip "$j";
|
||||
done
|
||||
done
|
6
UserScripts/diff-args
Executable file
6
UserScripts/diff-args
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
if [ "$1" != "$2" ]; then
|
||||
echo "These are different.";
|
||||
else
|
||||
echo "These are the same.";
|
||||
fi
|
8
UserScripts/expand-all
Executable file
8
UserScripts/expand-all
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
for i in $(find "$PWD" -type d); do
|
||||
cd $i;
|
||||
for j in $(find . -maxdepth 1 -type f); do
|
||||
gunzip $j;
|
||||
done
|
||||
done
|
5
UserScripts/failcount
Executable file
5
UserScripts/failcount
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
/bin/bash --rcfile <(cat /etc/bashrc; echo '
|
||||
export PS1="FAILCOUNT: \$failcount ""$PS1"
|
||||
trap '\''export failcount=$(( $failcount + $? ))'\'' DEBUG
|
||||
')
|
7
UserScripts/logged-shell
Executable file
7
UserScripts/logged-shell
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
export SHELL=/bin/bash
|
||||
export LOGFILE="/var/log/guest_log/$(/usr/bin/whoami)-$(date +%F-%R).log"
|
||||
env > $LOGFILE
|
||||
exec /bin/sh -c "script -a -q -f $LOGFILE"
|
||||
#/bin/bash -c "echo /usr/bin/logged-shell"
|
||||
exit
|
11
UserScripts/standardize-folder
Executable file
11
UserScripts/standardize-folder
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
export IFS="
|
||||
"
|
||||
export prefix="$(echo $PWD | rev | cut -f 1 -d '/' | rev)"
|
||||
firstext="$(ls | head -n 1 | rev | cut -f 1 -d \. | rev)"
|
||||
export count=1;
|
||||
for i in $(ls -tr *."$firstext" | grep -v "$prefix"); do
|
||||
mv "$i" "$prefix $count.$firstext"
|
||||
export count=$(($count+1))
|
||||
done
|
9
UserScripts/sysinfo
Executable file
9
UserScripts/sysinfo
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
(printf "%s | %s | %s %s | %s \n" \
|
||||
"$(uname -norm)" \
|
||||
"$(uptime -s)" \
|
||||
"$(grep -c processor /proc/cpuinfo)" \
|
||||
"$(grep -m 1 model\ name /proc/cpuinfo | cut -f 2 -d ':')" \
|
||||
"$(grep MemTotal /proc/meminfo)") \
|
||||
| sed 's/\s\+/ /g'
|
2
UserScripts/whatismyip
Executable file
2
UserScripts/whatismyip
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/lynx -connect_timeout=5 -read_timeout=5 --dump whatismyipaddress.com | grep '/ip/' | head -n 1 | cut -f 5 -d '/'
|
41
UserScripts/worktrack
Normal file
41
UserScripts/worktrack
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
command="$1"
|
||||
option="$2"
|
||||
|
||||
case "$command" in
|
||||
"new")
|
||||
# Start a new project
|
||||
mkdir -p ~/Documents/WorkTrack/"$option"
|
||||
cp /opt/worktrack/template.doc ~/Documents/WorkTrack/"$option"/track.doc
|
||||
chmod u+w ~/Documents/WorkTrack/"$option"/track.doc
|
||||
exec libreoffice --writer ~/Documents/WorkTrack/"$option"/track.doc
|
||||
;;
|
||||
"list")
|
||||
# Show available projects
|
||||
ls -l ~/Documents/WorkTrack
|
||||
;;
|
||||
"complete")
|
||||
# Hide a project from listing.
|
||||
mv ~/Documents/WorkTrack/"$option" ~/Documents/WorkTrack/\."$option"
|
||||
;;
|
||||
"cd")
|
||||
# enter the directory
|
||||
cd ~/Documents/WorkTrack/"$option"
|
||||
if [ $? -eq 0 ]; then exec /bin/bash; fi
|
||||
;;
|
||||
"purge")
|
||||
# Remove all completed projects
|
||||
rm -Ri ~/Documents/WorkTrack/\.[a-zA-Z1-9]*
|
||||
;;
|
||||
"edit")
|
||||
exec libreoffice --writer ~/Documents/WorkTrack/"$option"/track.doc
|
||||
;;
|
||||
*)
|
||||
echo Usage: $0 '[command]'
|
||||
echo Available commands:
|
||||
egrep '\"\) *$' $0 | cut -f 2 -d '"'
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
exit 0
|
Reference in New Issue
Block a user