GNU   davin.50webs.com/research
Bringing to you notes for the ages

       Main Menu          Research Projects         Photo Album            Curriculum Vitae      The Greatest Artists
    Email Address       Computer Games          Web Design          Java Training Wheels      The Fly (A Story)   
  Political Activism   Scruff the Cat       My Life Story          Smoking Cessation          Other Links      
Debugging Macros     String Class I     Linked List System I Java for C Programmers Naming Convention
    String Class II         How I use m4              Strings III                 Symmetrical I/O             Linked Lists II     
Run-Time Type Info   Virtual Methods      An Array System        Science & Religion            Submodes       
  Nested Packages      Memory Leaks    Garbage Collection      Internet & Poverty      What is Knowledge?
Limits of Evolution   Emacs Additions      Function Plotter           Romantic Love        The Next Big Thing
    Science Fiction     Faster Compilation Theory of Morality         Elisp Scoping               Elisp Advice      
  S.O.G.M. Pattern       Safe Properties         School Bullying          Charisma Control          Life and Death    
     Splitting Java          Multiple Ctors       Religious Beliefs         Conversation 1           Conversation 2    
   J.T.W. Language    Emacs Additions II      Build Counter             Relation Plotter          Lisp++ Language  
  Memory Leaks II   Super Constructors CRUD Implementation Order a Website Form There Is An Afterlife
More Occam's Razor C to Java Translator Theory of Morality II


demises.el

    

;;; demises.el

;; Copyright (C) 2006-2014 Davin Pearson

;; Author/Maintainer: Davin Max Pearson <http://davin.50webs.com>
;; Keywords: Cull Size Quota
;; Version: 1.0

;;; Commentary:

;; This file is not part of GNU Emacs.

;; This file warns against archive files that have decreased in size
;; as this may indicate loss of data.

;;; Limitation of Warranty

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs, see the file COPYING.  If not, see:
;;
;; <http://www.gnu.org/licenses/gpl-3.0.txt>.


;;; Install Instructions:
;; See the following URL for the latest info and a tarball:
;;
;; <http://davin.50webs.com/research/2006/mopa2e.html#demises>
;;
;; Then untar the tarball to a folder pointed to by the Emacs variable
;; load-path and add the following line to your ~/.emacs file.
;;
;; (require 'demises)

;;; Known Bugs:

;; None!

;;; Code:

(defvar demises--bufname "*demises*")

;;;
;;; (demises--get-demises-inner (setq dirname "~/bak") (setq extension ".tar.gz"))
;;; (demises--get-demises-inner (setq dirname "~/bak") (setq extension ".zip"))
;;;
;;; (setq ptr (bak--get-bases dirname extension))
;;;
(defun demises--get-demises-inner (dirname extension)

(assert (string-match "\\.\\(tar\\|tar\\.gz\\|zip\\)$" extension))
  ;;
  ;; (setq list '("bakw-h-dlisp"))
  ;;
  (let* ((list   (bak--get-bases dirname extension))
         (ptr    list)
         (list-2 nil))

(while ptr
      (setq list-2 (nreverse (directory-files dirname nil (concat "^"
                                                                  (car ptr)
                                                                  bak--yyyymmdd
                                                                  bak--hhmmss
                                                                  (regexp-quote extension)
                                                                  "$$"))))
      (if (>= (length list-2) 2)
          (save-excursion
            (let* ((newer (nth 0 list-2))
                   (older (nth 1 list-2))
                   (newer-size (nth 7 (file-attributes (concat dirname "/" newer))))
                   (older-size (nth 7 (file-attributes (concat dirname "/" older)))))
              (if (< newer-size (- older-size 2000))
                  (save-excursion
                    ;;(d-foo)
                    (set-buffer demises--bufname)
                    (goto-char (point-max))
                    (insert (format "*** demise of %d in new file %s\n" (- older-size newer-size) newer)
                    ;;(insert "*** file " newer " is smaller than " older "\n")
                    ))))))
      (setq ptr (cdr ptr))))

)

;; (demises-get-demises)
(defun demises-get-demises ()
  (interactive)

(setq demises-start-time (current-time))

(if (get-buffer demises--bufname)
      (kill-buffer demises--bufname))

(save-excursion
    (set-buffer (generate-new-buffer demises--bufname))
    (compilation-mode)
    (read-only-mode -1))

(demises--get-demises-inner "~/bak"     ".tar.gz")
  (demises--get-demises-inner "~/bak"     ".tar")
  (demises--get-demises-inner "~/bak"     ".zip")
  (demises--get-demises-inner "~/bak/baz" ".tar")

(save-excursion
    (set-buffer demises--bufname)
    (goto-char (point-min))
    ;;(flush-lines "bakw-h-workspace")
    (flush-lines "project")
    ;;(flush-lines "Function-Plotter-Setup")

    (let ((count 0))
      (goto-char (point-min))
      (while (re-search-forward "\\*\\*\\* demise of" nil t)
        (incf count))
      (progn
        (d-random-play-emacs-midi "/media/www/C1TB/sound-samples/emacs/completed-demises.wav")
        (d-say-number-improved count)
        (d-random-play-emacs-midi "/media/www/C1TB/sound-samples/emacs/numbers/demises-found.wav")
        )
      (goto-char (point-max))
      (insert (format "**** %d demise(s) found\n"  count))
      (insert (format "**** time took: %s\n"
                      (seconds-to-readable-string (seconds-of-time-difference demises-start-time (current-time))))
              )
      )

    ;;(message "No demises found")
    ;;(message "Finished with demises")

    (progn
      (switch-to-buffer demises--bufname)
      (save-excursion
        (setq s (buffer-string))
        (find-file (concat "~/bak/demises-" (d-time--get-stamp) ".comp"))
        (insert s)
        (save-buffer)
        (kill-buffer nil)))

(let ((ptr (nreverse (directory-files "~/bak" nil "^demises")))
          (i 0))
      (while (< i 10)
        (incf i)
        (setq ptr (cdr ptr)))
      (while ptr
        (delete-file (concat "~/bak/" (car ptr)))
        (setq ptr (cdr ptr))))
    )
  )

(provide 'demises)
Back
| Main Menu | Research Projects | Photo Album | Curriculum Vitae | The Greatest Artists |
| Email Address | Computer Games | Web Design | Java Training Wheels | The Fly (A Story) |
| Political Activism | Scruff the Cat | My Life Story | Smoking Cessation | Other Links |
| Debugging Macros | String Class I | Linked List System I | Java for C Programmers | Naming Convention |
| String Class II | How I use m4 | Strings III | Symmetrical I/O | Linked Lists II |
| Run-Time Type Info | Virtual Methods | An Array System | Science & Religion | Submodes |
| Nested Packages | Memory Leaks | Garbage Collection | Internet & Poverty | What is Knowledge? |
| Limits of Evolution | Emacs Additions | Function Plotter | Romantic Love | The Next Big Thing |
| Science Fiction | Faster Compilation | Theory of Morality | Elisp Scoping | Elisp Advice |
| S.O.G.M. Pattern | Safe Properties | School Bullying | Charisma Control | Life and Death |
| Splitting Java | Multiple Ctors | Religious Beliefs | Conversation 1 | Conversation 2 |
| J.T.W. Language | Emacs Additions II | Build Counter | Relation Plotter | Lisp++ Language |
| Memory Leaks II | Super Constructors | CRUD Implementation | Order a Website Form | There Is An Afterlife |
| More Occam's Razor | C to Java Translator | Theory of Morality II
Last modified: Sat Apr 29 18:38:36 NZST 2017
Best viewed at 800x600 or above resolution.
© Copyright 1999-2017 Davin Pearson.
Please report any broken links to