From 824fcee94265911e75b5178a413fd7acb96c660f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Mon, 15 Aug 2022 20:23:00 +0800 Subject: [PATCH] Removed unused resources --- bash/bashrc/sources/22_win-setups | 16 + bash/cronbackup/backup.sh | 96 ------ bash/cronbackup/backup_list | 11 - bash/cronbackup/config.sh | 9 - bash/cygwin/bin/cyg-import-key | 13 - bash/cygwin/bin/cyg-update | 2 - bash/cygwin/bin/cyg-update-installer | 27 -- bash/cygwin/bin/mkuserdirs | 11 - bash/hostconf/apply.sh | 30 -- bash/hostconf/noconf | 7 - deprecated/bash/amuleComplete.sh | 5 - deprecated/php/ByteArray.php | 496 --------------------------- php/astropenguin/botanical/Args.php | 55 --- php/astropenguin/package.php | 31 -- php/pkgstat.php | 58 ---- 15 files changed, 16 insertions(+), 851 deletions(-) create mode 100755 bash/bashrc/sources/22_win-setups delete mode 100644 bash/cronbackup/backup.sh delete mode 100644 bash/cronbackup/backup_list delete mode 100644 bash/cronbackup/config.sh delete mode 100755 bash/cygwin/bin/cyg-import-key delete mode 100755 bash/cygwin/bin/cyg-update delete mode 100755 bash/cygwin/bin/cyg-update-installer delete mode 100755 bash/cygwin/bin/mkuserdirs delete mode 100755 bash/hostconf/apply.sh delete mode 100644 bash/hostconf/noconf delete mode 100644 deprecated/bash/amuleComplete.sh delete mode 100644 deprecated/php/ByteArray.php delete mode 100644 php/astropenguin/botanical/Args.php delete mode 100644 php/astropenguin/package.php delete mode 100644 php/pkgstat.php diff --git a/bash/bashrc/sources/22_win-setups b/bash/bashrc/sources/22_win-setups new file mode 100755 index 0000000..3b55611 --- /dev/null +++ b/bash/bashrc/sources/22_win-setups @@ -0,0 +1,16 @@ +#!/bin/bash + +function mkuserdirs { + + local PROFILE PKG_DIR i + PROFILE=$( cygpath $USERPROFILE ) + for i in $( ls $PROFILE | grep -o "^[A-Z][a-z]\+$" ); do + ln -vs "$PROFILE/$i" $HOME/ + done + + # Package Directory + PKG_DIR="$APPDATA/../Local/Packages" + if [ -d "$PKG_DIR" ]; then + ln -vs "$PKG_DIR" $HOME/ + fi +} diff --git a/bash/cronbackup/backup.sh b/bash/cronbackup/backup.sh deleted file mode 100644 index 1796c04..0000000 --- a/bash/cronbackup/backup.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -source ./config.sh - -# IO Redirection -exec > $LOGFILE -exec 2> $ERRLOG - - -if [[ -n $BMOUNT ]] && ! grep -qs $BMOUNT /proc/mounts; then - echo Mounting $BMOUNT ... - mount $BMOUNT - MOUNTED=$? -fi - -if ! [ -d $BAKDIR ]; then - mkdir $BAKDIR -fi - - -echo Begin backup schedule: -echo Date: $(date) - -while read line; do - - # substring first char - firstChr=${line::1} - - # if line is not empty and does not start with "#" - - if [ $firstChr ] && [ $firstChr != "#" ]; then - - # file and arguments are seperated by ":" - IFS=':' read -ra ARGS <<< "$line" - - # Get file - FILE=${ARGS[0]} - - # if file exists - if [ -a $FILE ]; then - - # filename - FILENAME=$(basename $FILE) - - # set the backup name YYYYMMDDhhmm - BACKUPFILE=$(date +$FILENAME.%Y%m%d%H%M.tar.gz) - - # exclude file - EXCLUDE="exclude/${ARGS[1]}" - - CHDIR=$(dirname $FILE) - - if [ -d $FILE ]; then - CHDIR="$FILE/../" - fi - - if [ -f $EXCLUDE ]; then - tar zcf "$BAKDIR/$BACKUPFILE" -C $CHDIR $FILENAME -X $EXCLUDE - else - tar zcf "$BAKDIR/$BACKUPFILE" -C $CHDIR $FILENAME - fi - - # count backup file - fCount=$(ls $BAKDIR/$FILENAME.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].tar.gz|wc -l) - - echo " Check for existing backups "$FILENAME \(Have: $fCount\) - - # keep up to X backups - if [ $fCount -ne $KEEP ]; then - - # delete count - dCount=`expr $fCount - $KEEP` - - # loop over files - for files in $BAKDIR/*$FILENAME*.gz; do - if [ 0 -lt $dCount ]; then - - # remove expired file - echo " Removing expired backup: "$files - rm "$files"; - - # dCount -- - dCount=$((dCount-1)); - fi - done - fi - - fi - - fi - # echo --\> $line -done < backup_list - -if [[ "$MOUNTED" = 0 ]]; then - umount $BMOUNT -fi diff --git a/bash/cronbackup/backup_list b/bash/cronbackup/backup_list deleted file mode 100644 index a3b769e..0000000 --- a/bash/cronbackup/backup_list +++ /dev/null @@ -1,11 +0,0 @@ -# git backups -/home/git/repositories/blogAPI.git -/home/git/repositories/wenku8.git -/home/git/repositories/wenku8-android.git -/home/git/repositories/MetroSSH.git -/home/git/repositories/wconv.git -/home/git/repositories/utils.git - -# www -/var/www/wenku8 -/var/www/file:file.txt diff --git a/bash/cronbackup/config.sh b/bash/cronbackup/config.sh deleted file mode 100644 index 49be805..0000000 --- a/bash/cronbackup/config.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash` - -LOGFILE=backup.log -ERRLOG=backup_errors.log - -BMOUNT=/mnt/backup -BAKDIR=$BMOUNT/backup/cron - -KEEP=7 diff --git a/bash/cygwin/bin/cyg-import-key b/bash/cygwin/bin/cyg-import-key deleted file mode 100755 index 4c14f03..0000000 --- a/bash/cygwin/bin/cyg-import-key +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -PUBKEY_URL="https://cygwin.com/key/pubring.asc" - -TMP=$( mktemp ) - -function __o { rm $TMP; } -trap __o EXIT - - -curl "$PUBKEY_URL" > $TMP - -gpg2 --import $TMP diff --git a/bash/cygwin/bin/cyg-update b/bash/cygwin/bin/cyg-update deleted file mode 100755 index c4a9cc6..0000000 --- a/bash/cygwin/bin/cyg-update +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -/opt/setup-x86_64.exe -qg diff --git a/bash/cygwin/bin/cyg-update-installer b/bash/cygwin/bin/cyg-update-installer deleted file mode 100755 index 9739d29..0000000 --- a/bash/cygwin/bin/cyg-update-installer +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -SETUP_BIN="/opt/setup-x86_64.exe" - -SIG_URL="https://cygwin.com/setup-x86_64.exe.sig" -SETUP_URL="https://cygwin.com/setup-x86_64.exe" - -TMP_BIN=$( mktemp ) -TMP_SIG=$( mktemp ) - -function __o { rm $TMP_BIN; rm $TMP_SIG; } -trap __o EXIT - -echo "Downloading Signature ..." -curl -s "$SIG_URL" > $TMP_SIG -echo "Downloading setup binary ..." -curl -s "$SETUP_URL" > $TMP_BIN - -echo "Verifying Signature ..." -gpg2 -q --verify $TMP_SIG $TMP_BIN -if [ $? -ne 0 ]; then - echo "ERROR: Bad Signature!" -else - echo "Installing setup" - cp $TMP_BIN $SETUP_BIN - chmod +x $SETUP_BIN -fi diff --git a/bash/cygwin/bin/mkuserdirs b/bash/cygwin/bin/mkuserdirs deleted file mode 100755 index ca57660..0000000 --- a/bash/cygwin/bin/mkuserdirs +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -PROFILE=$( cygpath $USERPROFILE ) -for i in $( ls $PROFILE | grep -o "^[A-Z][a-z]\+$" ); do - ln -vs "$PROFILE/$i" $HOME/ -done - -# Package Directory -PKG_DIR="$APPDATA/../Local/Packages" -if [ -d "$PKG_DIR" ]; then - ln -vs "$PKG_DIR" $HOME/ -fi diff --git a/bash/hostconf/apply.sh b/bash/hostconf/apply.sh deleted file mode 100755 index 79aed6e..0000000 --- a/bash/hostconf/apply.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ -f $1 ]; then - source $1 -fi - -uname | grep -q Linux -LINUX=$? - -if [ "$LINUX" -eq "0" ]; then - HOST=/etc/hosts -else - HOST=/cygdrive/c/Windows/System32/drivers/etc/hosts -fi - -if [ ${HOSTNAMES[0]+1} ]; then - for i in {0..99}; - do - if [ ${HOSTNAMES[$i]+1} ]; then - XID="# Automated Host Def. Id. $i" - if grep -q "$XID" $HOST; then - - REC=$( echo "s/.*$XID$/${HOSTNAMES[$i]}\ $XID/g" | sed "s/\ /\\\ /g" ) - sed -i "$REC" $HOST - else - echo ${HOSTNAMES[$i]} $XID >> $HOST - fi - fi - done -fi diff --git a/bash/hostconf/noconf b/bash/hostconf/noconf deleted file mode 100644 index 58f237f..0000000 --- a/bash/hostconf/noconf +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -HOSTNAMES=() - -for i in {0..99}; do - HOSTNAMES[$i]="" -done diff --git a/deprecated/bash/amuleComplete.sh b/deprecated/bash/amuleComplete.sh deleted file mode 100644 index 8d77bb8..0000000 --- a/deprecated/bash/amuleComplete.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -cd /opt/utils -fileName=$(java Main_mod $1) -cd /media/Misc/Temp -mv $1 $fileName diff --git a/deprecated/php/ByteArray.php b/deprecated/php/ByteArray.php deleted file mode 100644 index 95a9c31..0000000 --- a/deprecated/php/ByteArray.php +++ /dev/null @@ -1,496 +0,0 @@ - - public function encrypt() { - - } - public function decrypt() { - - } - // - // - public function __get($prop) { - switch($prop) { - case 'length': - return count($this); - break; - case 'position': - return $this->position; - break; - case 'byteAvailable' : - return count($this) - $this->position; - break; - default : - return "Property($prop) is undefined"; - } - } - public function __set($prop, $val) { - try { - switch ($prop) { - case 'length': - if (is_int($val)) { - $l = count($this); - if ($val < $l) { - if ($val > -1) { - while ($val < count($this)) { - $this->offsetUnset(count($this) - 1); - } - } else { - new ERROR(ERROR::INVALID_DATA, "length($val)"); - } - } else { - while (count($this) < $val) - $this[] = 0; - } - } else { - new ERROR(ERROR::TYPE_MISSMATCH, "($val)", 'an integer'); - } - break; - case 'position': - if (is_int($val)) { - $l = count($this); - if ($val < $l) { - if ($val > -1) { - $this->position = $val; - } else { - new ERROR(ERROR::INVALID_DATA, "length($val)"); - } - } else { - new ERROR(ERROR::GREATER_COMPARATIVE, "Position($val)", "length($l)"); - } - } else { - new ERROR(ERROR::TYPE_MISSMATCH, "($val)", 'an integer'); - } - break; - case 'byteAvailable' : - new ERROR(ERROR::READ_ONLY, "Property($prop)"); - break; - default : - new ERROR(ERROR::UNDEFINED_DATA, "property($prop)"); - } - } catch(Exception $e) { - echo $e; - } - } - public function offsetSet($i, $val) { - try { - if(is_int($val)) { - if($i > -1) { - while(count($this) < $i) - $this[] = 0; - parent::offsetSet($i, $val & 0xff); - } else if($i == NULL) { - parent::offsetSet(count($this), $val & 0xff); - } else { - new ERROR(ERROR::TYPE_MISSMATCH, "index($val)"); - } - } else { - new ERROR(ERROR::TYPE_MISSMATCH, "($val)", 'an integer'); - } - } catch(Exception $e) { - echo $e; - } - } - // - public function compress() { - $str = gzcompress($this->save()); - $this->clear(); - $this->ByteArray($str); - } - public function deflate() { - $str = gzuncompress($this->save()); - $this->clear(); - $this->ByteArray($str); - } - public function save() { - $str = ''; - foreach($this as $i) - $str .= chr($i); - return $str; - } - public function clear() { - $this->length = 0; - $this->position = 0; - } - // - public function readBoolean() { - $p = $this->getPos(); - if ($p) - return (bool) $this[$p]; - else - return NULL; - } - public function readByte() { - //Returns -128 ~ 127 - $p = $this->getPos(); - if(is_int($p)) { - $p = $this[$p]; - return $p < 128 ? $p : $p - 256; - } - return NULL; - } - public function readBytes(ByteArray $b, $p = 0, $l = 0) { - try { - if (($this->position + $l) < count($this)) { - if ($l > 0 || ($l = count($this))) { - for ($i = 0; $i < $l; $i++) - $b[$p + $i] = $this->readByte(); - } else { - new ERROR(ERROR::UNDEFINED_DATA); - } - } else { - new ERROR(ERROR::EOF); - } - } catch (Exception $e) { - echo $e; - } - } - public function readDouble() { - //Reads an IEEE 754 double-precision (64-bit) floating-point number from the byte stream. - $s = $this->tobin($this->readByte()) - .$this->tobin($this->readByte()) - .$this->tobin($this->readByte()) - .$this->tobin($this->readByte()) - .$this->tobin($this->readByte()) - .$this->tobin($this->readByte()) - .$this->tobin($this->readByte()) - .$this->tobin($this->readByte()); - if($s*1 == 0) - return 0; - return $this->decodeIEEE($s); - } - - public function readFloat() { - //Reads an IEEE 754 single-precision (32-bit) floating-point number from the byte stream. - $s = $this->tobin($this->readByte()) - .$this->tobin($this->readByte()) - .$this->tobin($this->readByte()) - .$this->tobin($this->readByte()); - if($s*1 == 0) - return 0; - return $this->decodeIEEE($s); - } - public function readInt() { - //Returns -2147483648 ~ 2147483647 - if(($s = hexdec($this->tohex($this->readByte()) - .$this->tohex($this->readByte()) - .$this->tohex($this->readByte()) - .$this->tohex($this->readByte()))) - > 2147483647) - $s -= 4294967296; - return $s; - } - public function readMultiByte($length, $charSet) { - } - public function readShort() { - if(($s = hexdec($this->tohex($this->readByte()) - .$this->tohex($this->readByte()))) - > 32767) - $s -= 65536; - return $s; - } - public function readUnsignedByte() { - return hexdec($this->tohex($this->readByte())); - } - public function readUnsignedInt() { - return hexdec($this->tohex($this->readByte()) - .$this->tohex($this->readByte()) - .$this->tohex($this->readByte()) - .$this->tohex($this->readByte())); - } - public function readUnsignedShort() { - return hexdec($this->tohex($this->readByte()) - .$this->tohex($this->readByte()) - .$this->tohex($this->readByte()) - .$this->tohex($this->readByte())); - } - public function readUTF() { - } - public function readUTFBytes() { - } - // - // - public function writeBoolean($b) { - try { - if (is_bool($b)) { - new ERROR(ERROR::TYPE_MISSMATCH, "($b)"); - } else { - if ($this->position < count($this)) - $b ? ($this[$this->getPos()] = 1) : ($this[$this->getPos()] = 0); - else - $b ? ($this[] = 1) : ($this[] = 0); - } - } catch (Exception $e) { - echo $e; - } - } - public function writeByte($b) { - if($this->position < count($this)) { - $this[$this->getPos()] = $b; - } else { - $this[] = $b; - $this->getPos(); - } - } - public function writeBytes(ByteArray $b, $p = 0, $l = 0) { - try { - if ($l > 0 || ($l = count($b))) { - for ($i = 0; $i < $l; $i++) - $this->writeByte($b[$p + $i]); - } else { - new ERROR(ERROR::UNDEFINED_DATA); - } - } catch (Exception $e) { - echo $e; - } - } - public function writeDouble($num) { - if($num == 0) { - $num = str_pad('', 64, '0'); - } else { - $num = $this->encodeIEEE($num, 8)."\n"; - } - for($i = 0; $i < 64; $i += 8) - $this->writeByte(bindec(substr($num, $i, 8))); - } - public function writeFloat($num) { - if($num == 0) { - $num = str_pad('', 32, '0'); - } else { - $num = $this->encodeIEEE($num, 4)."\n"; - } - for($i = 0; $i < 32; $i += 8) - $this->writeByte(bindec(substr($num, $i, 8))); - } - public function writeInt($num) { - $this->writeByte($num >> 24 & 0xFF); - $this->writeByte($num >> 16 & 0xFF); - $this->writeByte($num >> 8 & 0xFF); - $this->writeByte($num & 0xFF); - } - public function writeMultiByte($length, $charSet) { - } - public function writeShort($num) { - $this->writeByte($num >> 8 & 0xFF); - $this->writeByte($num & 0xFF); - } - public function writeUnsignedInt($num) { - $this->writeByte($num >> 56 & 0xFF); - $this->writeByte($num >> 48 & 0xFF); - $this->writeByte($num >> 40 & 0xFF); - $this->writeByte($num >> 32 & 0xFF); - $this->writeByte($num >> 24 & 0xFF); - $this->writeByte($num >> 16 & 0xFF); - $this->writeByte($num >> 8 & 0xFF); - $this->writeByte($num & 0xFF); - } - public function writeUTF() { - } - public function writeUTFBytes() { - } - // - // - private function decodeIEEE($str) { - $s = $str[0] ? -1:1; - if(($l = strlen($str)) == 8) { - $e = bindec(substr($str, 1, 3)) - 3; - $m = substr($str, 4, 8); - } else if($l == 16) { - - } else if($l == 32) { - $e = bindec(substr($str, 1, 8)) - 127; - $m = '1'.substr($str, 9, 32); - } else if($l == 64) { - $e = bindec(substr($str, 1, 11)) - 1023; - $m = '1'.substr($str, 12, 64); - } - if((++ $e) > 0) { - $m1 = substr($m, 0, $e); - $m2 = substr($m, $e); - } else { - while($e < 0) { - $m = '0'.$m; - $e ++; - } - $m1 = 0; - $m2 = $m; - } - $str = 0; - $e = strlen($m1); - for($i = 0; $i < $e; $i ++) { - if($m1[$i]) { - $str += $m1[$i]*pow(2, ($e - 1) - $i); - } - } - $e = strlen($m2); - for($i = 0; $i < $e; $i ++) { - if($m2[$i]) { - $str += $m2[$i]*pow(2, -($i + 1)); - } - } - return $str*$s; - } - private function encodeIEEE($num, $byte) { - try { - if(is_numeric($num)) { - $s = $num > 0 ? 0:1; - $m1 = $s ? -1*$num : 1*$num; - $num = explode('.', $num); - $m1 = $num[0]*1; - if(count($num) > 1) - $m2 = '0.'.$num[1]; - else $m2 = '0'; - if($byte == 1) { - - } else if($byte == 2) { - - } else if($byte == 4) { - $e = 8; - $f = 23; - $b = 127; - } else if($byte == 8) { - $e = 11; - $f = 52; - $b = 1023; - } else { - new ERROR(ERROR::INVALID_DATA, "byte($byte)"); - } - $num = ''; - if($m1 > 1) { - $m1 = decbin($m1); - $e = str_pad(decbin(strlen($m1) - 1 + $b), $e, '0', STR_PAD_LEFT); - } else if($m1 == 1) { - $e = '0'.str_pad('', $e - 1, '1'); - } - $num .= $m1; - $f *= 2; - for($i = 0; $i < $f; $i ++) { - $m2 *= 2; - if($m2 >= 1) { - $num .= '1'; - $m2 -= 1; - } else { - $num .= '0'; - } - } - if($m1 == 0) { - for($m1 = 0; $num[0] == '0'; $m1 --) { - $num = substr($num, 1); - } - $e = str_pad(decbin($m1 + $b), $e, '0', STR_PAD_LEFT); - } - $num = substr($num, 1, $f *= .5); - $num || ($num = str_pad('', $f, '0')); - return "$s$e$num"; - } else { - new ERROR(ERROR::INVALID_DATA, $num); - } - } catch(Exception $e) { - echo $e; - } - } - // - private function getPos() { - - try { - if ($this->position < count($this)) - return $this->position++; - else - new ERROR(ERROR::EOF); - } catch (Exception $e) { - echo $e; - } - return NULL; - } - private function tobin($num) { - $num = $num < 0 ? $num + 256:$num; - $num = decbin($num); - while(strlen($num) != 8) { - $num = '0'.$num; - } - return $num; - } - private function tohex($num) { - return (($num = ($num < 0) ? $num + 256:$num) < 16) ? '0'.dechex($num):dechex($num); - } - } -//* Tests - $a = new ByteArray(); - $a->writeInt(12345); - $a->writeShort(11223); - $a->writeUnsignedInt(1125434357); - $a->position = 0; - echo "ReadInt: "; - echo $a->readInt()."\n"; - echo "ReadShort: "; - echo $a->readShort()."\n"; - echo "readUnsignedShort: "; - echo $a->readUnsignedInt()."\n"; - $a->position = 0; - $a->writeDouble(1); - $a->writeDouble(0); - $a->writeDouble(1.00123); - $a->writeDouble(0.2156); - $a->writeDouble(100); - $a->writeDouble(1012.1234); - - $a->writeFloat(2); - $a->writeFloat(1); - $a->writeFloat(0); - $a->writeFloat(0.00123); - $a->writeFloat(23.2156); - $a->writeFloat(150); - $a->writeFloat(132.1); - $a->position = 0; - echo "readDouble: "; - echo $a->readDouble()."\n"; - echo "readDouble: "; - echo $a->readDouble()."\n"; - echo "readDouble: "; - echo $a->readDouble()."\n"; - echo "readDouble: "; - echo $a->readDouble()."\n"; - echo "readDouble: "; - echo $a->readDouble()."\n"; - echo "readDouble: "; - echo $a->readDouble()."\n"; - - echo "readFloat: "; - echo $a->readFloat()."\n"; - echo "readFloat: "; - echo $a->readFloat()."\n"; - echo "readFloat: "; - echo $a->readFloat()."\n"; - echo "readFloat: "; - echo $a->readFloat()."\n"; - echo "readFloat: "; - echo $a->readFloat()."\n"; - echo "readFloat: "; - echo $a->readFloat()."\n"; - -//*/ -?> diff --git a/php/astropenguin/botanical/Args.php b/php/astropenguin/botanical/Args.php deleted file mode 100644 index 778f113..0000000 --- a/php/astropenguin/botanical/Args.php +++ /dev/null @@ -1,55 +0,0 @@ -getIterator(); - - //If options is set first - if( $iterator->valid() && preg_match ( '/^-\w$/', $iterator->current() ) ) - { - //iterate through whole argument stream - for ( ; $iterator->valid(); $iterator->next() ) - { - //Check if reached next option - if( preg_match ( '/^-\w$/', $opts = $iterator->current() ) ) - { - //Get current options - $currOpt = $opts; - //echo "$currOpt\n"; - //Test if next stream is an option - for ( $iterator->next(); $iterator->valid(); $iterator->next() ) - { - if ( preg_match ( '/^-\w$/', $opts = $iterator->current() ) ) - { - //echo "$currOpt $opts\n"; - $handler($currOpt); - $currOpt = $opts; - } else break; - //var_dump($iterator->valid()); - } - }//End if - //echo "$currOpt $opts\n"; - $handler($currOpt, $opts); - //A temporary fix for infinite loop - if(!$iterator->valid()) break; - }// End for - } - // If option is not set first. - else - { - //Try other approach. - } - // End if - } -} diff --git a/php/astropenguin/package.php b/php/astropenguin/package.php deleted file mode 100644 index ba4578c..0000000 --- a/php/astropenguin/package.php +++ /dev/null @@ -1,31 +0,0 @@ -> /tmp/php.apt_history.log"); -exec('cat /tmp/php.apt_history.log |egrep --regexp=\'^Commandline:\sapt-get\s[(install)(remove)(purge)]\'|awk \'{print $3" "$4}\'', $list); - -$i = 0; $j = 0; - -foreach($list as $entry) -{ - $history=explode(" ", $entry); - if($history[0] == "autoremove" || $history[0] == "upgrade")continue; - $history[0] == "install" ? ($packages[$history[1]]=true):($packages[$history[1]]=false); -} - -foreach($packages as $package => $stat) -{ - $stat ? ($ipackage[$i ++] = $package):($rpackage[$j ++] = $package); -} - -$i = sizeOf($ipackage); -$j = sizeOf($rpackage); - -$l = $i > $j ? $i:$j; - -echo "Custom package activities(apt-get):\n"; -echo "+---------------------------------------------------------+\n"; -echo "| Package(s) installed | Package(s) removed |\n"; -echo "|----------------------------+----------------------------|\n"; - -$ll = .5*(strlen("+---------------------------------------------------------+") - 3); - -for($k = 0; $k < $l; $k ++) { - $il = str_pad($k < $i ? $ipackage[$k]:"", $ll, " ", STR_PAD_BOTH); - $rl = str_pad($k < $j ? $rpackage[$k]:"", $ll, " ", STR_PAD_BOTH); - - - echo "|$il|$rl|\n"; -} - -echo "+---------------------------------------------------------+\n";