George Jones 6 years ago
parent
commit
71bf8e85dc
11 changed files with 20 additions and 392 deletions
  1. 5 0
      .link2home.ignore
  2. 1 0
      .signature
  3. 1 11
      README.org
  4. 13 2
      install
  5. 0 54
      install.sh
  6. 0 258
      mailhacks.org
  7. 0 3
      project-dotfiles.org
  8. 0 1
      rc.local/.ignore
  9. 0 2
      rc.local/anaconda.sh
  10. 0 11
      rc.local/aws.sh
  11. 0 50
      rc.local/passfuncs.sh

+ 5 - 0
.link2home.ignore

@@ -0,0 +1,5 @@
+.link2home.ignore
+.git
+README.org
+historical
+install

+ 1 - 0
.signature

@@ -1 +1,2 @@
 ---George Jones
+"My other editor is /bin/ed"

+ 1 - 11
README.org

@@ -1,14 +1,4 @@
-#+TITLE: George Jones's dotfiles and installation script
-#+DATE: <2016-02-23 04:59:42 Tuesday>
-
-This directory contains my generic dotfiles (.bashrc, etc) and (for
-historical reasons) my misc homegrown ~/bin/ utilities.
-
-- Install with install.sh
-
-- Project file (TODO'S etc) in project-dotfiles.org
-
-
+This repo contains dotfiles (e.g. /.bashrc/) to be installed  ${HOME}/
 
 
 

+ 13 - 2
rc.local/install → install

@@ -1,7 +1,7 @@
 #! /bin/bash
 # Link everthing in '$PWD' to a dir in '~/$PWD'
 #
-# Put a copy of his in any directory that should have it's
+# Put a COPY (not link) of his in any directory that should have it's
 # file linked into root.
 
 # Any files listed (one per line) in .install.ignore will be ignored
@@ -14,7 +14,18 @@ cd ${WHERE_AM_I}
 # Extract the directory name of this file
 BASEDIR=`basename $WHERE_AM_I`
 
+# find link2home.sh script
+if [ -e ${HOME}/bin/link2home.sh ]; then
+   LINK2HOME="${HOME}/bin/link2home.sh"
+elif [ -e ${WHERE_AM_I}/link2home.sh ]; then
+   LINK2HOME="${WHERE_AM_I}/link2home.sh"
+else
+   echo "Can't find link2home.sh"
+   exit 1
+fi
+
+
 echo Linking evertying in "${WHERE_AM_I}"  into "~/""${BASEDIR}"
-~/bin/link2home.sh -v -d
+${LINK2HOME} -v -d -r --home
 
 # any directory specific post-processing (permissions, etc) goes here.

+ 0 - 54
install.sh

@@ -1,54 +0,0 @@
-#! /bin/bash
-#
-# Link dotifles and bin into $HOME
-#
-
-set -e -u
-
-# Get the path to this (install.sh) script.
-#   See http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
-
-SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
-  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-  SOURCE="$(readlink "$SOURCE")"
-  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
-done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-
-
-# ~/bin will be an actual directory because in different contexts and
-# scopes with different projects/people it might have
-# different/additional things.
-
-mkdir -p $HOME/bin
-
-bin/link2 -r bin/link2 ~/bin/link2
-bin/link2 -r bin/linkall ~/bin/linkall
-
-# link the rest of bin/
-
-~/bin/linkall $DIR/bin ~/bin/
-
-
-link2=./bin/link2
-
-# link .dotfiles  into ~
-linkTo=$HOME
-linkThese=( .bashrc .gitconfig .hushlogin .signature) 
-
-
-for linkThis in ${linkThese[@]}; do
-  ${link2} -r $linkThis $linkTo
-done
-
-# link rc.local files in to ~/rc.local/
-
-mkdir -p ~/rc.local
-
-linkTo=$HOME/rc.local
-linkThese=( rc.local/*.sh) 
-
-for linkThis in ${linkThese[@]}; do
-  ${link2} -r $linkThis $linkTo
-done

+ 0 - 258
mailhacks.org

@@ -1,258 +0,0 @@
-#+OPTIONS: ':nil *:t -:t ::t <:t H:3 \n:nil ^:nil arch:headline
-#+OPTIONS: author:t broken-links:nil c:nil creator:nil
-#+OPTIONS: d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t
-#+OPTIONS: num:nil p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
-#+OPTIONS: timestamp:t title:t toc:nil todo:t |:t
-#+TITLE: mailhacks with offline imap, org mode and notmuch
-#+DATE: <2016-08-19 08:14:28 Friday>
-#+AUTHOR: George M Jones
-#+EMAIL: gmj@pobox.com
-#+LANGUAGE: en
-#+SELECT_TAGS: export
-#+EXCLUDE_TAGS: noexport
-#+CREATOR: Emacs 25.1.50.1 (Org mode 8.3.4)
-
-This is a set of hacks to pull email with
-https://github.com/OfflineIMAP/offlineimap,
-and classify it with https://notmuchmail.org/ tags and searches.
-
-Reading mail is also accomplished using the notmuch emacs interface
-https://notmuchmail.org/screenshots/, and sending is accomplished with
-the standard emacs message mode, though other options
-(e.g. Thunderbird) for reading/sending a possible since offlineimap is
-just dumping files in a MailDir format.
-
-This is an application of [[http://www.ranum.com/security/computer_security/papers/ai/][Marcus Ranum's concept "Artificial Ignorance"]] to
-my inbox, or =egrep -v ignoreThis\|ignoreThat\|ignoreTheOther= until
-there's nothing left.   The goal is to keep inbox nearly empty
-
-* Basic process
-  - pull mail down to local store with offlineimap
-  - Look at inbox, apply tags to the largest unclassified entries
-  - move them out of inbox
-  - repeat
-
-* Ingesting Mail
-  - This works with multiple IMAP accounts
-** Pull my latest mail
-#+name: getMyMail
-#+begin_src python :results output
-  import subprocess
-  import sys
-
-  cmd = "offlineimap > %s" % ("offlineimap.log")
-  print "Running '%s'..." % (cmd),
-
-  try:
-      #retcode = subprocess.call("echo foo", shell=True)
-      retcode = subprocess.call(cmd, shell=True)
-      if retcode < 0:
-          print >>sys.stderr, "Child was terminated by signal", -retcode
-          print >>sys.stdout, "Child was terminated by signal", -retcode
-      else:
-          print >>sys.stderr, "Child returned", retcode
-          print >>sys.stdout, "Child returned", retcode
-  except OSError as e:
-      print >>sys.stderr, "Execution failed:", e
-      print >>sys.stdout, "Execution failed:", e
-
-  print "Done."
-#+end_src
-
-#+RESULTS: getMyMail
-: Running 'offlineimap > offlineimap.log'... Child returned 0
-: Done.
-
-** Tell notmuch about the new mail
-  #+begin_src shell  :results output :exports both
-  exec 2>&1;date;set -e; set -u; set -x
-  
-  notmuch new
-  #+end_src
-
-  #+RESULTS:
-  : Fri Aug 19 07:09:12 EDT 2016
-  : + notmuch new
-  : Processed 125 total files in 1s (63 files/sec.).
-  : Added 119 new messages to the database. Detected 1 file rename.
-
-* Classifying Mail
-** Tags to classify things
-#+tblname: tagByHeader
-| tags                   | header  | subject                      | comments |
-|------------------------+---------+------------------------------+----------|
-| +onion +lists          | to      | security-onion               |          |
-| +argus +lists          | subject | ARGUS                        |          |
-| +saag +lists           | to      | saag                         |          |
-| +shmoolabs +lists      | subject | Labs-Alumni                  |          |
-| +honeypot +lists       | from    | honeynetproject@honeynet.org |          |
-| +opsec +lists          | subject | OPSEC                        |          |
-| +listmgt +lists        | from    | -owner                       |          |
-| +listmgt +lists        | from    | -requests                    |          |
-| +lists                 | subject | BSATroop161                  |          |
-| +sns                   | from    | sns.amazonaws.com            |          |
-| +social                | from    | linkedin                     |          |
-| +social                | subject | Google+                      |          |
-| +social                | from    | twitter.com                  | eludom   |
-| +social                | from    | facebookmail.com>            |          |
-| +accounts              | from    | audible.com                  |          |
-| +accounts              | from    | Amazon Web Services          |          |
-| +accounts              | from    | southwest.com                |          |
-| +accounts              | from    | account-update@amazon.com    |          |
-| +accounts              | from    | accounts.google.com          |          |
-| +accounts -inbox       | from    | livestream.com               | eludom   |
-| +finance               | from    | Mint.com                     |          |
-| +church                | from    | lcfweb.org                   |          |
-| +me                    | from    | gmj                          |          |
-| +me                    | from    | eludom                       |          |
-| +me                    | from    | George Jones                 |          |
-| +me                    | from    | fooologist                   |          |
-| +spam -inbox           | from    | tumblr.com                   |          |
-| +spam -inbox +accounts | subject | Spam                         |          |
-| +spam -inbox           | from    | noreply@youtube.com          |          |
-| +spam -inbox           | from    | news-googleplay@google.com   |          |
-| +spam +accounts -inbox | from    | discard-report@pobox.com     |          |
-
-** Apply tags
-
-#+begin_src python :var data=tagByHeader :results output
-import subprocess
-import sys
-
-for i in range(len(data)):
-    cmd = "notmuch tag %s -- %s:\"%s\"" % (data[i][0],data[i][1],data[i][2])
-    print "Running '%s'..." % (cmd),
-
-    try:
-        #retcode = subprocess.call("echo foo", shell=True)
-        retcode = subprocess.call(cmd, shell=True)
-        if retcode < 0:
-            print >>sys.stderr, "Child was terminated by signal", -retcode
-            print >>sys.stdout, "Child was terminated by signal", -retcode
-        else:
-            print >>sys.stderr, "Child returned", retcode
-            print >>sys.stdout, "Child returned", retcode
-    except OSError as e:
-        print >>sys.stderr, "Execution failed:", e
-        print >>sys.stdout, "Execution failed:", e
-
-    print "Done."
-
-#+end_src
-
-#+RESULTS:
-#+begin_example
-Running 'notmuch tag +onion +lists -- to:"security-onion"'... Child returned 0
-Done.
-Running 'notmuch tag +argus +lists -- subject:"ARGUS"'... Child returned 0
-Done.
-Running 'notmuch tag +saag +lists -- to:"saag"'... Child returned 0
-Done.
-Running 'notmuch tag +shmoolabs +lists -- subject:"Labs-Alumni"'... Child returned 0
-Done.
-Running 'notmuch tag +honeypot +lists -- from:"honeynetproject@honeynet.org"'... Child returned 0
-Done.
-Running 'notmuch tag +opsec +lists -- subject:"OPSEC"'... Child returned 0
-Done.
-Running 'notmuch tag +listmgt +lists -- from:"-owner"'... Child returned 0
-Done.
-Running 'notmuch tag +listmgt +lists -- from:"-requests"'... Child returned 0
-Done.
-Running 'notmuch tag +lists -- subject:"BSATroop161"'... Child returned 0
-Done.
-Running 'notmuch tag +sns -- from:"sns.amazonaws.com"'... Child returned 0
-Done.
-Running 'notmuch tag +social -- from:"linkedin"'... Child returned 0
-Done.
-Running 'notmuch tag +social -- subject:"Google+"'... Child returned 0
-Done.
-Running 'notmuch tag +social -- from:"twitter.com"'... Child returned 0
-Done.
-Running 'notmuch tag +social -- from:"facebookmail.com>"'... Child returned 0
-Done.
-Running 'notmuch tag +accounts -- from:"audible.com"'... Child returned 0
-Done.
-Running 'notmuch tag +accounts -- from:"Amazon Web Services"'... Child returned 0
-Done.
-Running 'notmuch tag +accounts -- from:"southwest.com"'... Child returned 0
-Done.
-Running 'notmuch tag +accounts -- from:"account-update@amazon.com"'... Child returned 0
-Done.
-Running 'notmuch tag +accounts -- from:"accounts.google.com"'... Child returned 0
-Done.
-Running 'notmuch tag +accounts -inbox -- from:"livestream.com"'... Child returned 0
-Done.
-Running 'notmuch tag +finance -- from:"Mint.com"'... Child returned 0
-Done.
-Running 'notmuch tag +church -- from:"lcfweb.org"'... Child returned 0
-Done.
-Running 'notmuch tag +me -- from:"gmj"'... Child returned 0
-Done.
-Running 'notmuch tag +me -- from:"eludom"'... Child returned 0
-Done.
-Running 'notmuch tag +me -- from:"George Jones"'... Child returned 0
-Done.
-Running 'notmuch tag +me -- from:"fooologist"'... Child returned 0
-Done.
-Running 'notmuch tag +spam -inbox -- from:"tumblr.com"'... Child returned 0
-Done.
-Running 'notmuch tag +spam -inbox +accounts -- subject:"Spam"'... Child returned 0
-Done.
-Running 'notmuch tag +spam -inbox -- from:"noreply@youtube.com"'... Child returned 0
-Done.
-Running 'notmuch tag +spam -inbox -- from:"news-googleplay@google.com"'... Child returned 0
-Done.
-Running 'notmuch tag +spam +accounts -inbox -- from:"discard-report@pobox.com"'... Child returned 0
-Done.
-#+end_example
-
-
-
-*** Action Items
-**** TODO Do I need to tag everything all the time?
-     <2016-07-24 Sun>
-     - It might be more efficient to only tag new messages, or
-       messages in the inbox, etc.  Right now, I tag all messages
-       every time.  Think about this.  Is it a problem?
-
-* Moving things out of "inbox"
-
-For now, this is just a list.  I'm moving things out of inbox by hand.
-This could be fed to a code block like we're doing with tagByHeader
-above.
-
-#+tblname: moveOutOfInbox
-| tags     | comment |
-|----------+---------|
-| lists    |         |
-| sns      |         |
-| social   |         |
-| accounts |         |
-| spam     |         |
-
-
-** Move all list mail out of my inbox
- #+begin_src shell  :results output :exports both
- exec 2>&1;date;set -e; set -u; set -x
-  
- notmuch tag -inbox -- tag:lists
- #+end_src
-
- #+RESULTS:
- : Sun Jul 24 08:09:24 EDT 2016
- : + notmuch tag -inbox -- tag:lists
-
-** Move a specific tag out of my inbox
-   Edit the tag below and execute the source block
- #+begin_src shell  :results output :exports both
- exec 2>&1;date;set -e; set -u; set -x
-  
- notmuch tag -inbox -- tag:spam
- #+end_src
-
- #+RESULTS:
- : Sun Jul 24 09:08:06 EDT 2016
- : + notmuch tag -inbox -- tag:spam
-
-* Ideas and Docs
-  - http://danamlund.dk/ubuntu_setup_old_notmuch.html

+ 0 - 3
project-dotfiles.org

@@ -1,3 +0,0 @@
-* Dotfiles Action Items
-* Dotfiles Backlog
-* Dotfiles Info

+ 0 - 1
rc.local/.ignore

@@ -1 +0,0 @@
-.ignore

+ 0 - 2
rc.local/anaconda.sh

@@ -1,2 +0,0 @@
-# added by Anaconda3 4.4.0 installer
-export PATH="/home/gmj/anaconda3/bin:$PATH"

+ 0 - 11
rc.local/aws.sh

@@ -1,11 +0,0 @@
-export PATH=~"~/.local/bin/:${PATH}"
-
-awsRmAll () {
-    # Remove all objects in an AWS bucket
-    #
-      aws s3 ls s3://$1 | sed 's/.*4 //' | sed 's/^/aws s3 rm s3:\/\/'$1'\//' | tee /dev/tty | cat
-}
-
-#
-
-alias awsrmall=awsRmAll

+ 0 - 50
rc.local/passfuncs.sh

@@ -1,50 +0,0 @@
-# Functions and aliases for working wtih pass(1)
-#
-# Usage:
-#   source passfuncs.sh
-#
-#     passurl pass-name  # print url
-#     passuser pass-name # print user
-#     passopen pass-name # print username, copy pasword to clipboard, open URL
-# 
-
-
-# define browser to use
-export passBrowser=google-chrome
-
-passurlFunc () {
-    # print the URL for a password stored in pass
-    #
-    # Assumes the URL is stored in a line like:
-    #
-    #   url: https://example.com
-    
-    pass $1 | grep '^url:' | sed 's/^[ \t]*url:[ \t]*//i'
-}
-
-passuserFunc () {
-    # print the username for a password stored in pass
-    #
-    # Assumes the username is stored in a line like:
-    #
-    #   username: FOO
-    
-    pass $1 | grep '^username:' | sed 's/^[ \t]*username:[ \t]*//i'
-}
-
-passopenFunc () {
-    # Print username, copy password to clipboard, open url in browser
-    #
-    # Assumes the URL is stored in a line like:
-    #
-    #   username: FOO
-
-    echo -n username: " "
-    passuserFunc $1
-    pass -c $1
-    $passBrowser `passurl $1` &
-}
-
-alias passurl=passurlFunc
-alias passuser=passuserFunc
-alias passopen=passopenFunc