mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
Updated some stuff hey
This commit is contained in:
1 parent
57485f6ffd
commit
d9eac44b35
24 files changed
+292
-57
No files matched your search
Executable
+6
@@ -0,0 +1,6 @@
|
||||
file=$1
|
||||
cowtype=`/usr/games/cowsay -l | tail -n +2 | tr ' ' '\n' | sort -R | head -1`
|
||||
beats=`echo "x = (\`date +%s\` + 3600) % 86400; scale=3; x / 86.4" | bc`
|
||||
|
||||
echo '3 1' > $file
|
||||
/usr/games/cowsay -W 24 -f $cowtype The time is @$beats >> $file
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
file=/home/krowbar/logs/du_log.json
|
||||
date=`date +%s`
|
||||
du_threshold=200
|
||||
|
||||
#prepare log file
|
||||
if [ -a "$file" ]
|
||||
then
|
||||
echo "Appending to existing log file: $file"
|
||||
head -n -1 $file > ${file}.swp #remove trailing "]" from last line
|
||||
mv ${file}.swp ${file}
|
||||
echo " ," >> $file
|
||||
else
|
||||
echo "Creating new log file: $file"
|
||||
touch $file
|
||||
echo "[" >> $file
|
||||
fi
|
||||
|
||||
#set up new object
|
||||
echo " {" >> $file
|
||||
echo " \"date\": $date," >> $file
|
||||
echo " \"data\": [" >> $file
|
||||
|
||||
add_comma=false
|
||||
for user_dir in /home/*
|
||||
do
|
||||
|
||||
user="~${user_dir#/home/}"
|
||||
disk_usage=`du -s $user_dir 2> /dev/null | cut -f 1`
|
||||
file_count=`find $user_dir -type f 2> /dev/null | wc -l`
|
||||
|
||||
if [ "$disk_usage" -gt "$du_threshold" ]
|
||||
then
|
||||
|
||||
if ${add_comma}
|
||||
then
|
||||
echo "," >> $file
|
||||
else
|
||||
add_comma=true
|
||||
fi
|
||||
echo -n " { \"user\": \"${user}\", \"du\": ${disk_usage}, \"files\": ${file_count} }" >> $file
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\n ]" >> $file #close new object data
|
||||
echo " }" >> $file #close new object
|
||||
echo "]" >> $file #close json array
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
quotesFile="/home/karlen/irc/quotes.txt"
|
||||
outFile="/home/krowbar/scratch/quotes.txt"
|
||||
|
||||
cat $quotesFile | grep -v '^[-/]' > $outFile
|
||||
Reference in new issue
Block a user