Permalink
Browse files

Update stuff

  • Loading branch information...
1 parent f266b3c commit c3b549fbbcd781b5c2a568635280cb649b52ebe7 Todd Foster committed May 25, 2012
Showing with 275 additions and 6 deletions.
  1. +31 −0 bin/publishSimpleNoteToBoidem.sh
  2. +124 −0 bin/sncat
  3. +22 −0 bin/syncBoxToGithub.sh
  4. +93 −5 configBard.txt
  5. +4 −0 dot.abcde.conf
  6. +1 −1 dot.bashrc
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+SRC="/home/foster/Documents/SimpleNote"
+DEST="/home/foster/Documents/toddfoster.github.com"
+
+# Update notes
+/home/foster/bin/sncat
+
+# Update repo
+cd $DEST
+git pull
+
+# Copy relevant notes into repo
+cd $SRC
+for I in boidem.*
+do
+ # Use the line below to select relevant files from all the SimpleNote notes.
+ # TODO: How to select by tags?
+ NAME=`expr $I : 'boidem.\(.*\)'`
+ echo "Found $I -> $NAME"
+
+ # Skip title and first non-title line (blank introduced in notational velocity)
+ # Copy them to the git repo
+ tail -n+2 $I > $DEST/$NAME
+done
+
+# Push repo
+cd $DEST
+git ci -a -m "Auto import from SimpleNote"
+# Uncomment the line below to go fully automatic! Then set up a cron job.
+git push
View
124 bin/sncat
@@ -0,0 +1,124 @@
+#!/usr/bin/env python
+
+# sncat: simplenote cat
+# Todd Foster, begun 21 April 2012
+#
+# Gets email, password from ~/.sncatrc with one per line: email = my_email@suremail.info
+#
+#
+# Starting point: http://www.leancrew.com/all-this/2010/01/exploring-the-simplenote-api/
+# I completely relied on this to get what I wanted out of simplenote
+# Similar idea to what I'm thinking, but in perl: http://ping13.net/hacks/snwatch/
+# Another similar idea, also in perl: https://github.com/fletcher/SimplenoteSync
+# Config parser lifted from: http://www.decalage.info/en/python/configparser
+#
+
+from urllib import urlopen
+from base64 import b64encode
+import json
+import os
+import sys
+import pickle
+
+COMMENT_CHAR = '#'
+OPTION_CHAR = '='
+def parse_config(filename):
+ options = {}
+ f = open(os.path.expanduser(filename))
+ for line in f:
+ # First, remove comments:
+ if COMMENT_CHAR in line:
+ # split on comment char, keep only the part before
+ line, comment = line.split(COMMENT_CHAR, 1)
+ # Second, find lines with an option=value:
+ if OPTION_CHAR in line:
+ # split on option char:
+ option, value = line.split(OPTION_CHAR, 1)
+ # strip spaces:
+ option = option.strip()
+ value = value.strip()
+ # store in dictionary:
+ options[option] = value
+ f.close()
+ return options
+
+def getNoteByKey(notes, key):
+ for note in notes:
+ if note['key'] == key:
+ return note
+ return None
+
+options = parse_config('~/.sncatrc')
+
+if options.has_key('destdir') and options.has_key('password'):
+ print "Retrieving simplenote notes for " + options['email']
+else:
+ print "email or password not specified in .sncatrc: Quitting."
+ sys.exit()
+
+if options.has_key('destdir'):
+ print "Specified destdir = " + options['destdir']
+else:
+ print "destdir not specified in .sncatrc: Quitting."
+ sys.exit()
+
+if options.has_key('pickleFile'):
+ pickleFile = options['pickleFile']
+
+destdir = os.path.expanduser(options['destdir'])
+
+# Get my authorization token for later calls.
+loginURL = 'https://simple-note.appspot.com/api/login'
+creds = b64encode('email=%s&password=%s' % (options['email'], options['password']))
+login = urlopen(loginURL, creds)
+token = login.readline().rstrip()
+login.close()
+
+# Get the current note index.
+indexURL = 'https://simple-note.appspot.com/api/index?auth=%s&email=%s' % (token, options['email'])
+index = urlopen(indexURL)
+newNoteList = json.load(index)
+
+# Get the previous note index
+oldNoteList = []
+pickleFile = destdir + '/.notelist.pkl'
+if os.path.isfile(pickleFile):
+ input = open(pickleFile,'rb')
+ oldNoteList = pickle.load(input)
+ input.close()
+
+# Retrieve changed notes, delete newly deleted notes
+baseURL = 'https://simple-note.appspot.com/api/note?key=%s&auth=%s&email=%s'
+titles = []
+for i in newNoteList:
+ oldNote = getNoteByKey(oldNoteList, i['key'])
+
+ # If file was already deleted, ignore
+ if i['deleted'] == True:
+ if oldNote is None: continue
+ if oldNote['deleted'] == True: continue
+
+ # Get info about note
+ noteURL = baseURL % (i['key'], token, options['email'])
+ note = urlopen(noteURL).read().decode('utf-8').rstrip()
+ encoded = '\n'.join(note.split('\n')[1:]).encode('utf-8')
+ title = note.split('\n')[0].rstrip()
+ path = destdir + '/' + title
+
+ #print '%s: %s' % (title, i)
+
+ # Only delete newly deleted notes
+ if i['deleted'] == True:
+ print 'Removing Title: %s' % (title)
+ if os.path.isfile(path): os.remove(path)
+ elif oldNote is None or i['modify'] > oldNote['modify'] or not os.path.isfile(path):
+ print 'Downloading Title: %s Modified: %s' % (title, i['modify'])
+ titles.append(title)
+ target = open (path, 'w')
+ print>>target, encoded
+ target.close()
+
+# Save new notelist
+output = open(pickleFile, 'wb')
+pickle.dump(newNoteList, output)
+output.close()
View
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# TODO: quit on error (e.g., git pull/push failures)
+
+SRC="/media/box/projects"
+DEST="/home/shared/box/projects"
+
+# Update repo
+cd $DEST
+
+for DIRECTORY in *
+do
+ echo "Found $DIRECTORY"
+ rsync -avc --exclude '.*' $SRC/$DIRECTORY/ $DIRECTORY/
+ cd $DIRECTORY
+ git commit -a -m "Auto-import from box.net"
+ git pull
+ git push
+ cd ..
+ rsync -avc --exclude '.*' $DIRECTORY/ $SRC/$DIRECTORY/
+done
+exit
View
@@ -5,10 +5,11 @@ Config video, disabling "laptop" display
Disable auto-lock, lengthen screensaver timeout
Copy files from ext hd
- - tef
+ (rsync -axv /media/bak2011/bak/brendan/toS3/toS3-20111022/ toS3)
+ - tef
- photos
- isos
- - music
+ - music
- toS3
Copy from old tef into new:
@@ -17,7 +18,12 @@ Copy from old tef into new:
.mozilla
.thunderbird
.Skype
+Documents
+Link ~/Templates to Documents/templates
+Also Videos, Music
+Link ~/Pictures to photos
+Configure printer
sudo apt-get install vim-gnome vim-doc ttf-dejavu
sudo apt-get install keepassx
@@ -26,10 +32,10 @@ sudo apt-get install git
git clone git@github.com:toddfoster/config.git
soft link all the dot.* files
-sudo apt-get install scanbuttond
-sudo ln -s /home/tef/config/scanbuttond/buttonpressed.sh /etc/scanbuttond/
+sudo apt-get install scanbuttond libtiff-tools
+sudo ln -s /home/foster/config/scanbuttond/buttonpressed.sh /etc/scanbuttond/
+edit /etc/default/scanbuttond to contain RUN_AS_USER = foster
-# Fan control: too loud!
sudo apt-get install fancontrol
sudo sensors-detect
sudo modprobe coretemp
@@ -41,4 +47,86 @@ sensors
sudo /usr/bin/fancontrol &
# should run automatically on next startup
+sudo apt-get install vlc mozilla-plugin-vlc
+sudo apt-get install imagemagick curl gimp xs imagemagick-doc enscript ffmpeg xfig xfig-doc
+sudo apt-get install ubuntu-restricted-extras
+sudo /usr/share/doc/libdvdread4/install-css.sh
+
+
+sudo apt-get install abcde python-musicbrainz eyed3 id3 id3v2 flac
+
+Static IP:
+ Network settings
+ bard: 192.168.1.97
+ Broadcast: 255.255.255.0
+ Route: 192.168.1.1
+ DNS: 208.67.222.222, 208.67.220.220 (OpenDNS)
+
+Sharing printer:
+ Application: "Printing"
+ Look for drop down menu (hidden by Unity): Server -> Settings
+ -Publish shared printers connected to this system
+
+Sharing files:
+ Easy in Nautilus: right click on folder -> Sharing
+ To allow subfolders to be accessed:
+ sudo vim /usr/share/samba/smb.conf
+ under [global] add "force user = foster"
+ sudo service smbd restart
+
+
+Install: stellarium, audacity, espeak
+Install: pcal psutils sshd
+Install: s3cmd
+
+Mounting box.net:
+Install: davfs2
+sudo echo “https://www.box.net/dav username password” >> /etc/davfs2/secrets
+mkdir /media/box
+https://www.box.net/dav /media/box davfs defaults,uid=username,gid=username 0 0
+
+crontab -l / -r / -e
+05 0,12 * * * /home/foster/bin/syncBoxToGithub.sh
+
+
+Install debian wheezy (testing) on 5 May 2012
+---------------------------------------------
+
+Tasksel: file server, print server, ssh server, additional base
+
+Install sudo, edit /etc/sudoers
+Install: fluxbox fbpager fbdesk fbautostart menul10n gksu xorg xdm
+add "xrandr --size 1920x1080" to ~/.fluxbox/startup
+Install: alsa-utils, sudo alsactl init
+Install:
+vim-gtk vim-doc ttf-dejavu
+synaptic iceweasel vlc mozilla-plugin-vlc keepassx
+imagemagick curl gimp xs imagemagick-doc enscript ffmpeg xfig xfig-doc
+abcde python-musicbrainz eyed3 id3 id3v2 flac
+stellarium, audacity, espeak
+pcal psutils
+s3cmd
+icedove
+openoffice.org
+pidgin pidgin-otr
+
+sudo apt-get install scanbuttond libtiff-tools
+sudo ln -s /home/foster/config/scanbuttond/buttonpressed.sh /etc/scanbuttond/
+edit /etc/default/scanbuttond to contain RUN_AS_USER = foster
+
+/etc/network/interfaces :
+iface eth0 inet static
+address 192.168.1.97
+netmask 255.255.255.0
+gateway 192.168.1.1
+
+/etc/resolv.conf : (OpenDNS)
+nameserver 208.67.222.222
+nameserver 208.67.220.220
+
+
+TODO
+Configure printer: http://localhost:631 or copy old cups file
+Configure file service
+Configure menus: .fluxbox/menu
View
@@ -0,0 +1,4 @@
+OUTPUTTYPE=flac
+OUTPUTFORMAT='${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM}-${TRACKFILE}'
+VAOUTPUTFORMAT='Various-${ALBUMFILE}/${TRACKNUM}-${TRACKFILE}-(${ARTISTFILE})'
+EJECTCD=y
View
@@ -1,5 +1,5 @@
-export PATH="~/bin:$PATH"
+export PATH="~/localbin:~/bin:$PATH"
export PS1="\W$ "
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

0 comments on commit c3b549f

Please sign in to comment.