From 617c9b5fb109e3f0ab387945ce9fc3d36eb07d64 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 22 Sep 2015 15:10:09 -0400 Subject: ssh: The Purdue CS boxes have a `host` that always exit(0). --- .config/ssh/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/ssh/config b/.config/ssh/config index dc32703..f651513 100644 --- a/.config/ssh/config +++ b/.config/ssh/config @@ -24,7 +24,7 @@ Host lukeshu.com Port 1863 User lukeshu -Match host build64-par exec "host %n.lan." +Match host build64-par exec "nslookup %n.lan." HostName build64-par Port 22 ForwardX11 yes -- cgit v1.2.3 From ef71eedb6bcc3889128af24df3aa668dde3e2c6f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 22 Aug 2015 03:46:53 -0400 Subject: emacs/init.el: tidy --- .config/emacs/init.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index e14d0f5..e635b77 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -149,7 +149,8 @@ "Use spaces for alignment" (let ((indent-tabs-mode nil)) (apply orig-fun args))) -(advice-add 'align-regexp :around #'align-regexp--use-spaces) +(advice-add 'align-regexp :around + #'align-regexp--use-spaces) (defun sh-smie-sh-rules--fix (args) "Replace :after \"then\" with :after \"if\" because Emacs 24 @@ -157,7 +158,8 @@ sh-script.el is broken." (if (equal args (list :after "then")) (list :after "if") args)) -(advice-add 'sh-smie-sh-rules :filter-args #'sh-smie-sh-rules--fix) +(advice-add 'sh-smie-sh-rules :filter-args + #'sh-smie-sh-rules--fix) (require 'go-mode-load nil t) -- cgit v1.2.3 From 1ae109d7abae11a327f362bfdfb623ac0ac770e0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 22 Aug 2015 03:51:52 -0400 Subject: Clean up bash configuration, and bash-emacs integration --- .config/bash/rc.d/01_unset_prompt_command.sh | 3 + .config/bash/rc.d/10_aliases.sh | 111 +++++++++++++++++++++++++++ .config/bash/rc.d/10_hist.sh | 9 +++ .config/bash/rc.d/10_misc.sh | 10 +++ .config/bash/rc.d/90_emacs.sh | 63 +++++++++++++++ .config/bash/rc.d/90_term_title.sh | 3 + .config/bash/rc.d/99_ps1.sh | 20 +++++ .config/bash/rc.d/aliases.sh | 63 --------------- .config/bash/rc.d/emacs.sh | 102 ------------------------ .config/bash/rc.sh | 65 +--------------- .config/emacs/init.el | 26 +++++++ 11 files changed, 247 insertions(+), 228 deletions(-) create mode 100644 .config/bash/rc.d/01_unset_prompt_command.sh create mode 100644 .config/bash/rc.d/10_aliases.sh create mode 100644 .config/bash/rc.d/10_hist.sh create mode 100644 .config/bash/rc.d/10_misc.sh create mode 100644 .config/bash/rc.d/90_emacs.sh create mode 100644 .config/bash/rc.d/90_term_title.sh create mode 100644 .config/bash/rc.d/99_ps1.sh delete mode 100644 .config/bash/rc.d/aliases.sh delete mode 100644 .config/bash/rc.d/emacs.sh diff --git a/.config/bash/rc.d/01_unset_prompt_command.sh b/.config/bash/rc.d/01_unset_prompt_command.sh new file mode 100644 index 0000000..165fdbc --- /dev/null +++ b/.config/bash/rc.d/01_unset_prompt_command.sh @@ -0,0 +1,3 @@ +#!/hint/bash + +PROMPT_COMMAND='' diff --git a/.config/bash/rc.d/10_aliases.sh b/.config/bash/rc.d/10_aliases.sh new file mode 100644 index 0000000..758c069 --- /dev/null +++ b/.config/bash/rc.d/10_aliases.sh @@ -0,0 +1,111 @@ +#!/hint/bash + +###################################################################### +# Set up colors and settings for all the things # +###################################################################### +if [ -x "`which dircolors`" ]; then + eval "$(dircolors -p | cat - "${XDG_CONFIG_HOME}/dir_colors" | + dircolors -b -)" + alias ls='ls -1v --color=auto' + alias dir='dir -v --color=auto' + alias vdir='vdir -v --color=auto' + + for xgrep in ${PATH//:/\/*grep }/*grep; do + if [ -f "$xgrep" ]; then + xgrep=$(basename "$xgrep") + if [ "$xgrep" != pgrep ]; then + alias $xgrep="$xgrep --color=auto" + fi + fi + done + unset xgrep + + wdiff() { + if [[ -t 1 ]]; then + local red="$(tput setaf 1)" + local blue="$(tput setaf 4)" + local bold="$(tput bold)" + local reset="$(tput sgr0)" + command wdiff \ + -w "$bold$red[-" \ + -x "-]$reset" \ + -y "$bold$blue{+" \ + -z "+}$reset" "$@" + else + command wdiff "$@" + fi + } + + diff() { + if [[ -t 1 ]]; then + ( + set -o pipefail + command diff "$@" | colordiff + ) + else + command diff "$@" + fi + } +else + alias ls='ls -1v' + alias dir='dir -v' + alias vdir='vdir -v' +fi + +###################################################################### +# Set up the standard aliases for ls # +###################################################################### +alias ll='ls -l' +alias la='ls -a' +alias l='ls -CF' + +###################################################################### +# Some preferences for miscellaneous stuff # +###################################################################### +#alias rm='gvfs-trash' +#alias sed='sed --follow-symlinks' # breaks operating on stdio in GNU sed 4.2.2 +alias tree='tree --charset utf8' +alias cd=pushd +alias gitk='gitk --all --date-order' +alias userctl='systemctl --user' + +###################################################################### +# These are actually functions :P # +###################################################################### +term-title() { + local fmt='' + case "$TERM" in + screen|tmux) fmt='\ek%s\e\\';; + xterm*|rxvt*) fmt='\e]0;%s\a';; + esac + printf "$fmt" "$*" +} +mvln() { + if [[ ! -L "$1" ]]; then + libremessages error 'Not a soft link: %s' "$1" + fi + target=$(readlink -f -- "$1") + ln -srT -- "$target" "$2" + if cmp -- "$1" "$2"; then + rm -f -- "$1" + else + libremessages error 'Failed moving link: %s -> %s' "$1" "$2" + fi +} +jarls() { + jar tf "$1" | + sed -n 's/\.class$//p' | + LC_ALL=C sort | + xargs -r -d $'\n' javap -classpath "$1" +} +tarls() { + local file + for file in "$@"; do + bsdtar tf "$file" | sed "s|^|$file:|" + done +} +jarmain() { + jarls "$1" 2>/dev/null | + grep -E '(^[a-z]|public static void main\(java\.lang\.String\[\]\))' | + grep -B1 '^ ' +} diff --git a/.config/bash/rc.d/10_hist.sh b/.config/bash/rc.d/10_hist.sh new file mode 100644 index 0000000..d7c6bfc --- /dev/null +++ b/.config/bash/rc.d/10_hist.sh @@ -0,0 +1,9 @@ +#!/hint/bash + +# don't overwrite GNU Midnight Commander's setting of `ignorespace'. +HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups +HISTFILE=${XDG_CACHE_HOME}/bash/history +HISTTIMEFORMAT='[%Y-%m-%d %H:%M] ' +HISTSIZE=5000 +shopt -s histappend # append to the history file, don't overwrite it +mkdir -p "${HISTFILE%/*}" diff --git a/.config/bash/rc.d/10_misc.sh b/.config/bash/rc.d/10_misc.sh new file mode 100644 index 0000000..afcf6fd --- /dev/null +++ b/.config/bash/rc.d/10_misc.sh @@ -0,0 +1,10 @@ +#!/hint/bash + +# General settings +shopt -s checkwinsize # update the values of LINES and COLUMNS +shopt -s globstar # Let ** recursively scan directories + +# Why is this not on by default? +# "We have a cached value, but it isn't valid anymore. Should we trash it?" +# "Duh, yes!" +shopt -s checkhash diff --git a/.config/bash/rc.d/90_emacs.sh b/.config/bash/rc.d/90_emacs.sh new file mode 100644 index 0000000..595ddcf --- /dev/null +++ b/.config/bash/rc.d/90_emacs.sh @@ -0,0 +1,63 @@ +#!/hint/bash + +if [[ $TERM == eterm* ]]; then + ## Primatives for interacting with Emacs ############################### + + # _emacs_run LISP + _emacs_run() { + emacsclient -a false -e "$*" 2>/dev/null + } + # _emacs_quote UNQUOTED_STRING + _emacs_quote() { + local str="$*" + str="${str//\\/\\\\}" # \ -> \\ + str="${str//\"/\\\"}" # " -> \" + str="\"${str}\"" # wrap it in quotes + printf '%s' "$str" + } + # _emacs_unquote QUOTED_STRING + _emacs_unquote() { + local str="$*" + if [[ $str =~ ^\"(.*)\"$ ]]; then + str=${BASH_REMATCH[1]} # un-quote it + str="${str//\\\\/\\}" # \\ -> \ + str="${str//\\\"/\"}" # \" -> " + fi + printf '%s' "$str" + } + + ## High-level tasks #################################################### + + # Set the TRAMP directory for remote hosts (shell -> emacs) + _emacs_set_remote_dir() { + # Because (term-handle-ansi-terminal-messages) is run + # after each item is set, the user should be set + # before the hostname is set, otherwise it will set + # (default-directory) to an invalid TRAMP string. + # + # Because the hostname is compared to (system-name) to + # check if it is localhost, "$(hostname -f)" needs to + # be used instead of $HOSTNAME, unfortunately. + printf '\eAnSiT%s %s\n' \ + u "$USER" \ + c "$PWD" \ + h "$(hostname -f)" + } + # Set the shell's X11 display (emacs -> shell) + _emacs_set_shell_DISPLAY() { + export DISPLAY=$(_emacs_unquote "$(_emacs_run "(cdr (assoc 'display (frame-parameters)))")") + [[ $DISPLAY != nil ]] || unset DISPLAY + } + + ## Install the hooks ################################################### + + export SELECTED_EDITOR='emacsclient' + export EDITOR=$SELECTED_EDITOR + export VISUAL=$SELECTED_EDITOR + export PAGER=cat + if _emacs_run '()' >/dev/null; then + PROMPT_COMMAND+='_emacs_set_shell_DISPLAY;' + fi + # Remember, the $() strips the trailing newline, so add it back in + PS1_EXTRA+='\[$(_emacs_set_remote_dir)'$'\n\\]' +fi diff --git a/.config/bash/rc.d/90_term_title.sh b/.config/bash/rc.d/90_term_title.sh new file mode 100644 index 0000000..d39d8b0 --- /dev/null +++ b/.config/bash/rc.d/90_term_title.sh @@ -0,0 +1,3 @@ +#!/hint/bash + +PS1_EXTRA+="\\[$(term-title '\u@\h:\w')\\]" diff --git a/.config/bash/rc.d/99_ps1.sh b/.config/bash/rc.d/99_ps1.sh new file mode 100644 index 0000000..450e118 --- /dev/null +++ b/.config/bash/rc.d/99_ps1.sh @@ -0,0 +1,20 @@ +#!/hint/bash + +if tput setaf 1 &>/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + RESET="\\[$(tput sgr0)\\]" + BOLD="\\[$(tput bold)\\]" + RED="\\[$(tput setaf 1)\\]" + GREEN="\\[$(tput setaf 2)\\]" + BLUE="\\[$(tput setaf 4)\\]" + + STATUS="${BOLD}[" + STATUS+="\$(v=\$?; [[ \$v = 0 ]] && c='${GREEN}' || c='${RED}'; printf %s%03i \$c \$v)" + STATUS+="${RESET}${BOLD}]${RESET}" +else + STATUS='[$(printf "%03i" $?)]' +fi +PS1="${STATUS} ${BOLD}${GREEN}\u@\h${BLUE}:\w${RESET}${PS1_EXTRA}\\n\\$ " +unset RESET BOLD RED GREEN BLUE STATUS PS1_EXTRA diff --git a/.config/bash/rc.d/aliases.sh b/.config/bash/rc.d/aliases.sh deleted file mode 100644 index cd2cfd8..0000000 --- a/.config/bash/rc.d/aliases.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/hint/bash - -###################################################################### -# Set up colors and settings for ls/dir/vdir # -###################################################################### -if [ -x "`which dircolors`" ]; then - eval "$(dircolors -p | cat - "${XDG_CONFIG_HOME}/dir_colors" | - dircolors -b -)" - alias ls='ls -1v --color=auto' - alias dir='dir -v --color=auto' - alias vdir='vdir -v --color=auto' - - for xgrep in ${PATH//:/\/*grep }/*grep; do - if [ -f "$xgrep" ]; then - xgrep=`basename "$xgrep"` - if [ "$xgrep" != pgrep ]; then - alias $xgrep="$xgrep --color=auto" - fi - fi - done -else - alias ls='ls -1v' - alias dir='dir -v' - alias vdir='vdir -v' -fi - -###################################################################### -# Set up the standard aliases for ls # -###################################################################### -alias ll='ls -l' -alias la='ls -a' -alias l='ls -CF' - -###################################################################### -# Some preferences for miscellaneous stuff # -###################################################################### -#alias rm='gvfs-trash' -#alias sed='sed --follow-symlinks' # breaks sed 4.2.2 -alias tree='tree --charset utf8' -alias cd=pushd -alias gitk='gitk --all --date-order' -alias userctl='systemctl --user' - -###################################################################### -# Some almost-function aliases # -###################################################################### -alias lock="clear; away -C 'This terminal is locked'" -alias plock="term-title Terminal Locked;lock" -mvln() { - if [[ ! -L "$1" ]]; then - libremessages error 'Not a soft link: %s' "$1" - fi - target=$(readlink -f -- "$1") - ln -srT -- "$target" "$2" - if cmp -- "$1" "$2"; then - rm -f -- "$1" - else - libremessages error 'Failed moving link: %s -> %s' "$1" "$2" - fi -} -jarls() { jar tf "$1" | sed -n 's/\.class$//p' | LC_ALL=C sort | xargs -r -d $'\n' javap -classpath "$1"; } -tarls() { local file; for file in "$@"; do bsdtar tf "$file" | sed "s|^|$file:|"; done; } -jarmain() { jarls "$1" 2>/dev/null | grep -E '(^[a-z]|public static void main\(java\.lang\.String\[\]\))' | grep -B1 '^ '; } diff --git a/.config/bash/rc.d/emacs.sh b/.config/bash/rc.d/emacs.sh deleted file mode 100644 index d8e1d80..0000000 --- a/.config/bash/rc.d/emacs.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/hint/bash - -if [[ $TERM == eterm* ]]; then - SELECTED_EDITOR='emacsclient' - EDITOR=$SELECTED_EDITOR - VISUAL=$SELECTED_EDITOR - export SELECTED_EDITOR EDITOR VISUAL - export PAGER=cat - - ## Primatives for interacting with Emacs ############################### - - # _emacs_run LISP - _emacs_run() { - emacsclient -a false -e "$*" 2>/dev/null - } - # _emacs_quote UNQUOTED_STRING - _emacs_quote() { - local str="$*" - str="${str//\\/\\\\}" # \ -> \\ - str="${str//\"/\\\"}" # " -> \" - str="\"${str}\"" # wrap it in quotes - printf '%s' "$str" - } - # _emacs_unquote QUOTED_STRING - _emacs_unquote() { - - local str="$*" - if [[ $str =~ ^\"(.*)\"$ ]]; then - str=${BASH_REMATCH[1]} # un-quote it - str="${str//\\\\/\\}" # \\ -> \ - str="${str//\\\"/\"}" # \" -> " - fi - printf '%s' "$str" - } - - ## Deal with renaming the terminal ##################################### - - # _emacs_rename_terminal NEW_BUFFER_NAME - # This function uses the variable _EMACS_BUFFER to store some state - _emacs_rename_terminal() { - local name=$(_emacs_quote "$*") - if [[ -n $_EMACS_BUFFER ]]; then - local buffer="(get-buffer $_EMACS_BUFFER)" - else - local buffer='(window-buffer (selected-window))' - fi - _EMACS_BUFFER=$(_emacs_run "(with-current-buffer ${buffer} (rename-buffer ${name} t))") - } - # _emacs_get_short_cwd - _emacs_get_short_cwd() { - local base=$PWD - local suffix='' - # The regex here is a list of directory names - # that aren't really helpful, and that the - # parent directory should be included also. - if [[ $base =~ (/(src|pkg|doc|pkg-libre|src-libre|trunk|tags|branches))*$ ]]; then - suffix=$BASH_REMATCH - base=${base%$suffix} - fi - base=${base##*/} - echo ${base}${suffix} - } - # _emacs_get_desired_buffer_name - _emacs_get_desired_buffer_name() { - echo "*ansi-term*<$(_emacs_get_short_cwd)>" - } - - ## High-level tasks #################################################### - - # Like uniquify on the buffer name (shell -> emacs) - _emacs_set_buffer_name() { - # This doesn't work correctly on remote hosts. - # The "correct" solution is probably to hook into - # default-directory being set in term.el - _emacs_rename_terminal "$(_emacs_get_desired_buffer_name)" - } - # Set the TRAMP directory for remote hosts (shell -> emacs) - _emacs_set_remote_dir() { - if [[ -n $SSH_CONNECTION ]]; then - printf '\eAnSiT%s %s\n' \ - u "$USER" \ - c "$PWD" \ - h "$HOSTNAME" - fi - } - # Set the shell's X11 display (emacs -> shell) - _emacs_set_shell_DISPLAY() { - export DISPLAY=$(_emacs_unquote "$(_emacs_run "(cdr (assoc 'display (frame-parameters)))")") - [[ $DISPLAY != nil ]] || unset DISPLAY - } - - ## Do those things ##################################################### - - _emacs_PROMPT_COMMAND() { - _emacs_set_buffer_name - _emacs_set_remote_dir - _emacs_set_shell_DISPLAY - } - if _emacs_run '()' >/dev/null; then - PROMPT_COMMAND=_emacs_PROMPT_COMMAND - fi -fi diff --git a/.config/bash/rc.sh b/.config/bash/rc.sh index 70f1ce4..8512d84 100644 --- a/.config/bash/rc.sh +++ b/.config/bash/rc.sh @@ -5,74 +5,13 @@ # they are login shells or not. # If not running interactively, don't do anything -[[ $- != *i* ]] && return +# This line is probably not nescessary, but whatevs. +[[ $- == *i* ]] || return # GDM failsafe ignores profile (login) settings, but I use XDG stuff # here. . "${XDG_CONFIG_HOME:-$HOME/.config}"/login.d/??_xdg.sh -# Why is this not on by default? -# "We have a cached value, but it isn't valid anymore. Should we trash it?" -# "Duh, yes!" -shopt -s checkhash - -################################################################################ - -# History settings -# don't overwrite GNU Midnight Commander's setting of `ignorespace'. -HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups -HISTFILE=${XDG_CACHE_HOME}/bash/history -HISTTIMEFORMAT='[%Y-%m-%d %H:%M] ' -HISTSIZE=5000 -shopt -s histappend # append to the history file, don't overwrite it -mkdir -p "${HISTFILE%/*}" - -# General settings -shopt -s checkwinsize # update the values of LINES and COLUMNS -shopt -s globstar # Let ** recursively scan directories - -################################################################################ -# Overly complicated setting of PS1 # -################################################################################ - -# Belongs in aliases, but I use it here -term-title() { - local fmt='' - case "$TERM" in - screen|tmux) fmt='\ek%s\e\\';; - xterm*|rxvt*) fmt='\e]0;%s\a';; - esac - printf "$fmt" "$*" -} -PROMPT_COMMAND='' - -make_prompt() { - echo "${BOLD}${GREEN}\u@\h${BLUE}:\w${RESET}" -} - -if tput setaf 1 &>/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - RESET="$(tput sgr0)" - BOLD="$(tput bold)" - RED="$(tput setaf 1)" - GREEN="$(tput setaf 2)" - BLUE="$(tput setaf 4)" - - _STATUS="${BOLD}[" - _STATUS+="\$(v=\$?; [[ \$v = 0 ]] && c='${GREEN}' || c='${RED}'; printf %s%03i \$c \$v)" - _STATUS+="${RESET}${BOLD}]${RESET}" -else - _STATUS='[$(printf "%03i" $?)]' -fi -PS1="${_STATUS} $(make_prompt)"'\n\$ ' -unset RESET BOLD RED GREEN BLUE _STATUS -PS1="$(term-title $(make_prompt))$PS1" -unset make_prompt - -################################################################################ - # Include modular config files if [[ -d ${XDG_CONFIG_HOME}/bash/rc.d ]]; then for file in "${XDG_CONFIG_HOME}/bash/rc.d"/*.sh; do diff --git a/.config/emacs/init.el b/.config/emacs/init.el index e635b77..90fda1b 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -161,6 +161,32 @@ sh-script.el is broken." (advice-add 'sh-smie-sh-rules :filter-args #'sh-smie-sh-rules--fix) +;; Ideally, figuring this out should be done by uniquify, but I +;; haven't determined how to get uniquify to think that it manages the +;; term buffer. +(defun term-get-short-cwd () + ;; local base=$PWD + ;; local suffix='' + ;; # The regex here is a list of directory names + ;; # that aren't really helpful, and that the + ;; # parent directory should be included also. + ;; if [[ $base =~ (/(src|pkg|doc|pkg-libre|src-libre|trunk|tags|branches))*$ ]]; then + ;; suffix=$BASH_REMATCH + ;; base=${base%$suffix} + ;; fi + ;; base=${base##*/} + ;; echo ${base}${suffix} + (directory-file-name default-directory)) +(defun term-handle-ansi-terminal-messages--uniquify (args) + (rename-buffer (concat + (replace-regexp-in-string "<.*>$" "" (buffer-name)) + "<" + (term-get-short-cwd) + ">") + t)) +(advice-add 'term-handle-ansi-terminal-messages :after + #'term-handle-ansi-terminal-messages--uniquify) + (require 'go-mode-load nil t) -- cgit v1.2.3 From e3840259dab27b4e9570d33297d410868a1f9c13 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 24 Aug 2015 00:11:22 -0400 Subject: systemd --- .config/systemd/user/emacs-daemon.service | 2 +- .config/systemd/user/wmii@.service.wants/dunst@.service | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 120000 .config/systemd/user/wmii@.service.wants/dunst@.service diff --git a/.config/systemd/user/emacs-daemon.service b/.config/systemd/user/emacs-daemon.service index 279d83a..4077e97 100644 --- a/.config/systemd/user/emacs-daemon.service +++ b/.config/systemd/user/emacs-daemon.service @@ -4,7 +4,7 @@ Description=Emacs deamon [Service] Type=forking ExecStart=/bin/bash -l -c 'emacs --daemon' -ExecStop=/bin/bash -l -c 'emacsclient -e "(kill-emacs)"' +ExecStop=/bin/bash -l -c 'emacsclient -a false -e "(kill-emacs)"' [Install] WantedBy=default.target diff --git a/.config/systemd/user/wmii@.service.wants/dunst@.service b/.config/systemd/user/wmii@.service.wants/dunst@.service new file mode 120000 index 0000000..7635e45 --- /dev/null +++ b/.config/systemd/user/wmii@.service.wants/dunst@.service @@ -0,0 +1 @@ +../dunst@.service \ No newline at end of file -- cgit v1.2.3 From f773fc22cc8057c719eef94d90c07de8a7230d0a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 22 Sep 2015 15:28:40 -0400 Subject: systemd: add synergy unit --- .config/systemd/user/synergy@.service | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .config/systemd/user/synergy@.service diff --git a/.config/systemd/user/synergy@.service b/.config/systemd/user/synergy@.service new file mode 100644 index 0000000..18961f2 --- /dev/null +++ b/.config/systemd/user/synergy@.service @@ -0,0 +1,9 @@ +[Unit] +Description=Keyboard and mouse sharing on X display %I +StopWhenUnneeded=true + +[Service] +Type=simple +Environment=DISPLAY=%I +ExecStart=/usr/bin/synergy +Restart=always -- cgit v1.2.3 From 6fd75fa99cc547ed9b9aa3657d698ac9552cc7f9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 22 Sep 2015 15:20:20 -0400 Subject: clean up systemd dependencies --- .config/systemd/user/lxpanel@.service | 4 ++++ .config/systemd/user/panel@.target | 3 +++ .config/systemd/user/panel@.target.requires/lxpanel@.service | 1 + .config/systemd/user/synergy@.service | 1 + .config/systemd/user/wm@.target | 1 - .config/systemd/user/wm@.target.requires/wmii@.service | 1 + .config/systemd/user/wmii@.service | 3 +++ 7 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .config/systemd/user/panel@.target create mode 120000 .config/systemd/user/panel@.target.requires/lxpanel@.service create mode 120000 .config/systemd/user/wm@.target.requires/wmii@.service diff --git a/.config/systemd/user/lxpanel@.service b/.config/systemd/user/lxpanel@.service index 71e2114..ecded87 100644 --- a/.config/systemd/user/lxpanel@.service +++ b/.config/systemd/user/lxpanel@.service @@ -3,9 +3,13 @@ Description=LXDE Desktop Panel on X display %I Documentation=man:lxpanel(1) StopWhenUnneeded=true After=wm@%i.target +Before=panel@%i.target [Service] Type=simple Environment=DISPLAY=%I ExecStart=/usr/bin/lxpanel Restart=always + +[Install] +RequiredBy=panel@%i.target diff --git a/.config/systemd/user/panel@.target b/.config/systemd/user/panel@.target new file mode 100644 index 0000000..ed3dffd --- /dev/null +++ b/.config/systemd/user/panel@.target @@ -0,0 +1,3 @@ +[Unit] +Description=Desktop Panel (System Tray) on display %I +StopWhenUnneeded=true diff --git a/.config/systemd/user/panel@.target.requires/lxpanel@.service b/.config/systemd/user/panel@.target.requires/lxpanel@.service new file mode 120000 index 0000000..06ed03f --- /dev/null +++ b/.config/systemd/user/panel@.target.requires/lxpanel@.service @@ -0,0 +1 @@ +../lxpanel@.service \ No newline at end of file diff --git a/.config/systemd/user/synergy@.service b/.config/systemd/user/synergy@.service index 18961f2..df0640a 100644 --- a/.config/systemd/user/synergy@.service +++ b/.config/systemd/user/synergy@.service @@ -1,6 +1,7 @@ [Unit] Description=Keyboard and mouse sharing on X display %I StopWhenUnneeded=true +Requires=panel@%i.target [Service] Type=simple diff --git a/.config/systemd/user/wm@.target b/.config/systemd/user/wm@.target index ac91fa1..c114bf5 100644 --- a/.config/systemd/user/wm@.target +++ b/.config/systemd/user/wm@.target @@ -1,3 +1,2 @@ [Unit] Description=Window Manager on display %I -Requires=wmii@%i.service diff --git a/.config/systemd/user/wm@.target.requires/wmii@.service b/.config/systemd/user/wm@.target.requires/wmii@.service new file mode 120000 index 0000000..1b202d2 --- /dev/null +++ b/.config/systemd/user/wm@.target.requires/wmii@.service @@ -0,0 +1 @@ +../wmii@.service \ No newline at end of file diff --git a/.config/systemd/user/wmii@.service b/.config/systemd/user/wmii@.service index 0442fca..4a81e3f 100644 --- a/.config/systemd/user/wmii@.service +++ b/.config/systemd/user/wmii@.service @@ -12,3 +12,6 @@ NotifyAccess=all Environment=DISPLAY=%I ExecStart=/usr/bin/bash -l -c 'exec 8>${XDG_RUNTIME_DIR}/x11-wm@%I; exec /usr/bin/wmii' ExecStop=/usr/bin/wmiir xwrite /ctl Quit + +[Install] +RequiredBy=wm@%i.service -- cgit v1.2.3 From 9abaebb597d396a24c51f7c7c03e4145963f6bb1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 22 Sep 2015 15:53:26 -0400 Subject: .config/login.d/02_xdg_runtime_dir.sh only runs on login, no need for a check In fact, the check broke the Purdue CS boxes because it was being run under the Xsession program, which is not a login shell. --- .config/login.d/02_xdg_runtime_dir.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/login.d/02_xdg_runtime_dir.sh b/.config/login.d/02_xdg_runtime_dir.sh index 864eadd..6db58af 100644 --- a/.config/login.d/02_xdg_runtime_dir.sh +++ b/.config/login.d/02_xdg_runtime_dir.sh @@ -1,7 +1,7 @@ #!/hint/sh # Set XDG_RUNTIME_DIR if we can -if [ -z "$XDG_RUNTIME_DIR" ] && shopt -q login_shell && type flock &>/dev/null; then +if [ -z "$XDG_RUNTIME_DIR" ] && type flock &>/dev/null; then _diy_xdg_runtime_login() { export XDG_RUNTIME_DIR="$XDG_CACHE_HOME/xdg-runtime-dir/$HOSTNAME" if ! [ /dev/fd/7 -ef "$XDG_CACHE_HOME/xdg-runtime-dir/.lock" ]; then -- cgit v1.2.3 From 1cdc7055122eae4a260b0f6f5aaa5522af145e43 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 4 Oct 2015 15:04:21 -0400 Subject: Be more careful about what happens when XDG_RUNTIME_DIR isn't set. --- .config/X11/clientrc | 5 ++++- .config/login.d/90_dot-runtime.sh | 6 +++++- .config/wmii-hg/include.sh | 4 ++++ .config/wmii-hg/rbar.sh | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.config/X11/clientrc b/.config/X11/clientrc index ac0d5a8..bc68ed6 100644 --- a/.config/X11/clientrc +++ b/.config/X11/clientrc @@ -17,7 +17,10 @@ if [ -f "$usermodmap" ]; then xmodmap "$usermodmap" fi -[ -n "$XDG_RUNTIME_DIR" ] || exit 1 +if [ -z "$XDG_RUNTIME_DIR" ]; then + printf "XDG_RUNTIME_DIR isn't set\n" >&2 + exit 6 +fi _DISPLAY="$(systemd-escape -- "$DISPLAY")" trap "rm -f $(printf '%q' "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}")" EXIT mkfifo "${XDG_RUNTIME_DIR}/x11-wm@${_DISPLAY}" diff --git a/.config/login.d/90_dot-runtime.sh b/.config/login.d/90_dot-runtime.sh index d06568f..cb0b7f2 100644 --- a/.config/login.d/90_dot-runtime.sh +++ b/.config/login.d/90_dot-runtime.sh @@ -1,4 +1,8 @@ # This is really only needed for ssh ControlPath; as I don't have a # way to communicate XDG_RUNTIME_DIR to it otherwise. mkdir -p -- ~/.runtime -ln -sfT -- "$XDG_RUNTIME_DIR" ~/.runtime/"$HOSTNAME" +if [ -n "$XDG_RUNTIME_DIR" ]; then + ln -sfT -- "$XDG_RUNTIME_DIR" ~/.runtime/"$HOSTNAME" +else + ln -sfT -- /tmp ~/.runtime/"$HOSTNAME" +fi diff --git a/.config/wmii-hg/include.sh b/.config/wmii-hg/include.sh index 4e86276..f8c4e0d 100644 --- a/.config/wmii-hg/include.sh +++ b/.config/wmii-hg/include.sh @@ -1,4 +1,8 @@ #!/hint/bash +if [[ -z "$XDG_RUNTIME_DIR" ]]; then + printf "XDG_RUNTIME_DIR isn't set\n" >&2 + exit 6 +fi if [[ -z "$WMII_NAMESPACE" ]]; then export WMII_NAMESPACE="$(wmiir namespace)" diff --git a/.config/wmii-hg/rbar.sh b/.config/wmii-hg/rbar.sh index 0c9efa6..287f427 100644 --- a/.config/wmii-hg/rbar.sh +++ b/.config/wmii-hg/rbar.sh @@ -1,4 +1,9 @@ #!/hint/bash +if [[ -z "$XDG_RUNTIME_DIR" ]]; then + printf "XDG_RUNTIME_DIR isn't set\n" >&2 + exit 6 +fi + setup_trap() { trap "rm -f -- \"\${XDG_RUNTIME_DIR}\"/n/wmii*/rbar/${1}" EXIT } -- cgit v1.2.3 From 64423da6f1b192aeb1c96282afc049b69ff8b763 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 24 Sep 2015 16:07:53 -0400 Subject: bash emacs integration: only fall back to `hostname -f` if necessary --- .config/bash/rc.d/90_emacs.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.config/bash/rc.d/90_emacs.sh b/.config/bash/rc.d/90_emacs.sh index 595ddcf..79d5e61 100644 --- a/.config/bash/rc.d/90_emacs.sh +++ b/.config/bash/rc.d/90_emacs.sh @@ -36,12 +36,16 @@ if [[ $TERM == eterm* ]]; then # (default-directory) to an invalid TRAMP string. # # Because the hostname is compared to (system-name) to - # check if it is localhost, "$(hostname -f)" needs to - # be used instead of $HOSTNAME, unfortunately. + # check if it is localhost, "$(hostname -f)" may need + # to be used instead of $HOSTNAME, if + # $HOSTNAME/$(hostname) doesn't return a qualified + # domain. + local hostname=$HOSTNAME + [[ $hostname = *.* ]] || hostname="$(hostname -f)" printf '\eAnSiT%s %s\n' \ u "$USER" \ c "$PWD" \ - h "$(hostname -f)" + h "$hostname" } # Set the shell's X11 display (emacs -> shell) _emacs_set_shell_DISPLAY() { -- cgit v1.2.3 From 1649d56246a2bbd65ca0ac970fee2f27f9ee6ecc Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 25 Sep 2015 11:25:59 -0400 Subject: Have he Makefile be smarter about when it needs to do things --- .config/Makefile | 10 ++- .config/dconf/user.txt | 200 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 4 deletions(-) create mode 100644 .config/dconf/user.txt diff --git a/.config/Makefile b/.config/Makefile index 9ee3115..002a933 100644 --- a/.config/Makefile +++ b/.config/Makefile @@ -10,9 +10,10 @@ GIT_DIR = ${HOME}/.git targets = \ ${GIT_DIR}/info/exclude \ - ${HOME}/.folders \ ${XDG_CACHE_HOME}/config-symlinks/cookie \ - ${XDG_CACHE_HOME}/cron/cookie + $(if $(shell crontab -l),${XDG_CACHE_HOME}/cron/cookie) \ + $(if $(wildcard ${HOME}/Maildir),${HOME}/.folders) \ + $(if $(wildcard ${XDG_CONFIG_HOME}/dconf/user),${XDG_CONFIG_HOME}/dconf/user.txt) all: $(targets) clean: @@ -24,6 +25,9 @@ ${HOME}/.folders: ${HOME}/Maildir $(MAKEFILE_LIST) ${GIT_DIR}/info/exclude: ${HOME}/.git.info.exclude.in $(shell echo .??*/) ( cat $<; find $^ -type f -name 'CACHEDIR.TAG' -printf '%h\n'|sed 's@^\./@/@' ) > $@ +${XDG_CONFIG_HOME}/dconf/user.txt: ${XDG_CONFIG_HOME}/dconf/user + dconf dump / > $@ + ${XDG_CACHE_HOME}/cron/cookie: ${XDG_CONFIG_HOME}/cron -(cat $^/*; echo) | crontab - 2>/dev/null mkdir -p '$(@D)' @@ -34,8 +38,6 @@ ${XDG_CACHE_HOME}/config-symlinks/cookie: ${XDG_CONFIG_HOME}/symlinks mkdir -p '$(@D)' date > '$@' -${HOME}/Maildir: - mkdir -p '$@'/{cur,new,tmp} ${HOME}/Maildir/%: | ${HOME}/Maildir mkdir -p '$@'/{cur,new,tmp} touch '$@'/maildirfolder diff --git a/.config/dconf/user.txt b/.config/dconf/user.txt new file mode 100644 index 0000000..48a55eb --- /dev/null +++ b/.config/dconf/user.txt @@ -0,0 +1,200 @@ +[org/mate/terminal/profiles/default] +background-color='#FFFFFFFFDDDD' +login-shell=true +palette='#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC' +bold-color='#000000000000' +foreground-color='#000000000000' +visible-name='Default' + +[org/mate/eom/ui] +image-collection=false +sidebar=false + +[org/mate/engrampa/listing] +sort-method='name' +name-column-width=250 +sort-type='ascending' +list-mode='as-folder' +show-path=false + +[org/mate/engrampa/ui] +sidebar-width=200 +window-height=480 +window-width=600 + +[org/mate/volume-control] +window-height=886 +window-width=1706 + +[org/mate/screenshot] +include-pointer=true +include-border=true +border-effect='none' +delay=0 + +[org/mate/desktop/peripherals/keyboard] +numlock-state='off' + +[org/mate/desktop/accessibility/keyboard] +slowkeys-beep-press=true +mousekeys-accel-time=1200 +bouncekeys-beep-reject=true +slowkeys-beep-reject=false +togglekeys-enable=false +enable=false +bouncekeys-enable=false +stickykeys-enable=false +feature-state-change-beep=false +slowkeys-beep-accept=true +bouncekeys-delay=300 +mousekeys-max-speed=750 +mousekeys-enable=false +timeout-enable=false +slowkeys-delay=300 +stickykeys-modifier-beep=true +stickykeys-two-key-off=true +mousekeys-init-delay=160 +timeout=120 +slowkeys-enable=false + +[org/mate/desktop/background] +color-shading-type='solid' +primary-color='#a1a184845c5c' +picture-options='wallpaper' +picture-filename='' +secondary-color='#3c3c8f8f2525' + +[org/mate/desktop/font-rendering] +antialiasing='grayscale' +dpi=95.0 +hinting='full' + +[org/mate/desktop/session] +session-start=1443192888 + +[org/mate/pluma/plugins/filebrowser/on-load] +virtual-root='file:///tmp' +tree-view=true +root='file:///' + +[org/mate/pluma] +statusbar-visible=true + +[org/mate/marco/general] +mouse-button-modifier='' +side-by-side-tiling=true +focus-mode='click' +theme='Purdue' + +[org/mate/panel/general] +show-program-list=true +toplevel-id-list=['top', 'bottom'] +history-mate-run=['/homes/shumakl/.prefix.x86_64/bin/urxvt', '/bin/bash --noprofile --norc', 'mate-terminal /bin/sh', 'vncviewer', 'gimp', 'emacs', 'killall emacs', 'urxvt', 'mate-terminal bash --noprofile --norc', 'mate-terminal'] +object-id-list=['menu-bar', 'separator', 'terminal', 'web-browser', 'notification-area', 'clock', 'window-menu', 'show-desktop', 'window-list', 'workspace-switcher', 'object_0'] + +[org/mate/panel/toplevels/bottom] +expand=true +orientation='bottom' +screen=0 +y-bottom=0 +size=24 +y=1055 + +[org/mate/panel/toplevels/top] +expand=true +orientation='top' +screen=0 +size=24 + +[org/mate/panel/objects/workspace-switcher] +applet-iid='WnckletFactory::WorkspaceSwitcherApplet' +locked=true +toplevel-id='bottom' +position=0 +object-type='applet' +panel-right-stick=true + +[org/mate/panel/objects/clock] +applet-iid='ClockAppletFactory::ClockApplet' +locked=true +toplevel-id='top' +position=5 +object-type='applet' +panel-right-stick=true + +[org/mate/panel/objects/clock/prefs] +format='12-hour' +custom-format='' + +[org/mate/panel/objects/object_0] +launcher-location='v-editor.desktop' +toplevel-id='top' +position=296 +object-type='launcher' +panel-right-stick=false + +[org/mate/panel/objects/separator] +locked=true +toplevel-id='top' +position=5 +object-type='separator' + +[org/mate/panel/objects/menu-bar] +locked=true +toplevel-id='top' +position=0 +object-type='menu-bar' + +[org/mate/panel/objects/window-menu] +applet-iid='WnckletFactory::WindowMenuApplet' +locked=true +toplevel-id='top' +position=0 +object-type='applet' +panel-right-stick=true + +[org/mate/panel/objects/window-list] +applet-iid='WnckletFactory::WindowListApplet' +locked=true +toplevel-id='bottom' +position=20 +object-type='applet' + +[org/mate/panel/objects/notification-area] +applet-iid='NotificationAreaAppletFactory::NotificationArea' +locked=true +toplevel-id='top' +position=10 +object-type='applet' +panel-right-stick=true + +[org/mate/panel/objects/show-desktop] +applet-iid='WnckletFactory::ShowDesktopApplet' +locked=true +toplevel-id='bottom' +position=0 +object-type='applet' + +[org/mate/panel/objects/web-browser] +locked=true +launcher-location='/usr/share/applications/firefox.desktop' +toplevel-id='top' +position=10 +object-type='launcher' + +[org/mate/panel/objects/terminal] +locked=true +launcher-location='urxvt.desktop' +toplevel-id='top' +position=10 +object-type='launcher' + +[org/mate/caja/window-state] +start-with-sidebar=true +geometry='800x550+312+123' +start-with-status-bar=true +maximized=true +start-with-toolbar=true + +[org/mate/atril/default] +window-ratio=(3.1209150326797386, 1.2676767676767677) -- cgit v1.2.3 From 890e856fce07001fd82018b1a075faa684a198aa Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 4 Oct 2015 14:57:45 -0400 Subject: Emacs: newer go-mode --- .config/emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 90fda1b..38f6e77 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -112,6 +112,7 @@ (:name nginx-mode :type elpa :after (put 'nginx-indent-level 'safe-local-variable 'integerp)) (:name scss-mode :type elpa) + (:name go-mode :type elpa) )) ;; What packages el-get should install, both from above, and it's ;; internal list of sources. @@ -130,6 +131,7 @@ ;;nxhtml ; nxhtml is invasive, only enable if actively using bison-mode coffee-mode + go-mode graphviz-dot-mode haml-mode markdown-mode @@ -187,8 +189,6 @@ sh-script.el is broken." (advice-add 'term-handle-ansi-terminal-messages :after #'term-handle-ansi-terminal-messages--uniquify) -(require 'go-mode-load nil t) - ;; Make the mouse work in an xterm -- cgit v1.2.3 From 795875623f9a9cd35374d2f0531182a267e81588 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 4 Oct 2015 15:00:07 -0400 Subject: update purdue mail filters --- .config/maildirproc/purdue.rc | 368 ++++++++++++++++++++++++------------------ 1 file changed, 207 insertions(+), 161 deletions(-) diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index f086eee..a09d7ab 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -24,8 +24,11 @@ def is_to_or_from_re(mail,address): def piazza_topic(mail, topic): return ( - is_to_or_from(mail, topic+" on Piazza") - or mail["Subject"].contains(topic+" on Piazza")) + False + or is_to_or_from(mail, topic+" on Piazza") + or mail["Subject"].contains(topic+" on Piazza") + or (is_to_or_from(mail, "@piazza.com>") and mail["Subject"].contains(" in "+topic+": ")) + ) def my_filters(mail): # Generic stuff ######################################################## @@ -79,6 +82,7 @@ def my_filters(mail): or is_to_or_from(mail, "@alerts.comcast.net") or is_to_or_from(mail, "rentpayment.com") or is_to_or_from(mail, "@vectren.com") + or is_to_or_from(mail, "@vectrenemail.com") ): mail.move("INBOX.housing.BeauJardin") return @@ -91,7 +95,11 @@ def my_filters(mail): mail.move("INBOX.crap.CERIAS") return - if is_to_or_from(mail,"royfu@purdue.edu"): + if ( + False + or is_to_or_from(mail,"royfu@purdue.edu") + or is_to_or_from(mail,"usmannkhan@purdue.edu") + ): mail.move("INBOX.crap.Hackers") return @@ -123,173 +131,211 @@ def my_filters(mail): mail.move("INBOX.crap.cron") return - # Fall 2012 ############################################################ - - # SCI210 (Teaming principles) - if mail["Subject"].contains("Fall-2012-SCI-21000-001:"): - mail.move("INBOX.classes.2012-2.SCI210") - # CS180 (Java) - if mail["Subject"].contains("fall-2012-cs-18000"): - mail.move("INBOX.classes.2012-2.CS180") - return - if piazza_topic(mail, "CS 18000"): - mail.move("INBOX.classes.2012-2.CS180.Piazza") - return - # SOC100 - if mail["Subject"].contains("Fall-2012-SOC-10000"): - mail.move("INBOX.classes.2012-2.SOC100") - return - - # Spring 2013 ########################################################## - - # CS240 (C) - if mail["Subject"].contains("[CS240] Submission result for"): - mail.move("INBOX.classes.2013-1.CS240.autograder") - return - if mail["Subject"].contains("[CS240]") or mail["Subject"].contains("Spring-2013-CS-24000"): - mail.move("INBOX.classes.2013-1.CS240") - return - if piazza_topic(mail, "CS 240"): - mail.move("INBOX.classes.2013-1.CS240.Piazza") - return - # PHYS220 - if mail["Subject"].matches(".*(PHYS|CHIP)\s*220.*") or is_to_or_from(mail,"srdas@purdue.edu"): - mail.move("INBOX.classes.2013-1.PHYS220") - return - # SOC220 (Social Problems) - if mail["Subject"].contains("Spring-2013-SOC-22000"): - mail.move("INBOX.classes.2013-1.SOC220") - return - - # Fall 2013 ############################################################ - - # CS250 (Computer Architecture) - if mail["Subject"].contains("Fall-2013-CS-25000"): - mail.move("INBOX.classes.2013-2.CS250") - return - if piazza_topic(mail, "CS 250") or piazza_topic(mail, "CS 250-FALL2013"): - mail.move("INBOX.classes.2013-2.CS250.Piazza") - return - # CS251 (Intro Algo) - if mail["Subject"].contains("Fall-2013-CS-25100"): - mail.move("INBOX.classes.2013-2.CS251") - return - if piazza_topic(mail, "CS 251"): - mail.move("INBOX.classes.2013-2.CS251.Piazza") - return - # SPAN101 - if mail["Subject"].contains("Fall-2013-SPAN-10100"): - mail.move("INBOX.classes.2013-2.SPAN101") - return - # MA261 (Calc III) - if mail["Subject"].contains("Fall-2013-MA-26100"): - mail.move("INBOX.classes.2013-2.MA261") - return - # MA265 (Linear Algebra) - if mail["Subject"].contains("Fall-2013-MA-26500"): - mail.move("INBOX.classes.2013-2.MA265") - return - - # Spring 2014 ########################################################## - - # COM217 - if mail["Subject"].contains("Spring-2014-COM-21700-004"): - mail.move("INBOX.classes.2014-1.COM217") - return - if mail["From"].contains("mixable") and mail["Subject"].matches("^COM 21700"): - mail.move("INBOX.classes.2014-1.COM217.Mixable") + # # Fall 2012 ############################################################ + + # # SCI210 (Teaming principles) + # if mail["Subject"].contains("Fall-2012-SCI-21000-001:"): + # mail.move("INBOX.classes.2012-2.SCI210") + # # CS180 (Java) + # if mail["Subject"].contains("fall-2012-cs-18000"): + # mail.move("INBOX.classes.2012-2.CS180") + # return + # if piazza_topic(mail, "CS 18000"): + # mail.move("INBOX.classes.2012-2.CS180.Piazza") + # return + # # SOC100 + # if mail["Subject"].contains("Fall-2012-SOC-10000"): + # mail.move("INBOX.classes.2012-2.SOC100") + # return + + # # Spring 2013 ########################################################## + + # # CS240 (C) + # if mail["Subject"].contains("[CS240] Submission result for"): + # mail.move("INBOX.classes.2013-1.CS240.autograder") + # return + # if mail["Subject"].contains("[CS240]") or mail["Subject"].contains("Spring-2013-CS-24000"): + # mail.move("INBOX.classes.2013-1.CS240") + # return + # if piazza_topic(mail, "CS 240"): + # mail.move("INBOX.classes.2013-1.CS240.Piazza") + # return + # # PHYS220 + # if mail["Subject"].matches(".*(PHYS|CHIP)\s*220.*") or is_to_or_from(mail,"srdas@purdue.edu"): + # mail.move("INBOX.classes.2013-1.PHYS220") + # return + # # SOC220 (Social Problems) + # if mail["Subject"].contains("Spring-2013-SOC-22000"): + # mail.move("INBOX.classes.2013-1.SOC220") + # return + + # # Fall 2013 ############################################################ + + # # CS250 (Computer Architecture) + # if mail["Subject"].contains("Fall-2013-CS-25000"): + # mail.move("INBOX.classes.2013-2.CS250") + # return + # if piazza_topic(mail, "CS 250") or piazza_topic(mail, "CS 250-FALL2013"): + # mail.move("INBOX.classes.2013-2.CS250.Piazza") + # return + # # CS251 (Intro Algo) + # if mail["Subject"].contains("Fall-2013-CS-25100"): + # mail.move("INBOX.classes.2013-2.CS251") + # return + # if piazza_topic(mail, "CS 251"): + # mail.move("INBOX.classes.2013-2.CS251.Piazza") + # return + # # SPAN101 + # if mail["Subject"].contains("Fall-2013-SPAN-10100"): + # mail.move("INBOX.classes.2013-2.SPAN101") + # return + # # MA261 (Calc III) + # if mail["Subject"].contains("Fall-2013-MA-26100"): + # mail.move("INBOX.classes.2013-2.MA261") + # return + # # MA265 (Linear Algebra) + # if mail["Subject"].contains("Fall-2013-MA-26500"): + # mail.move("INBOX.classes.2013-2.MA265") + # return + + # # Spring 2014 ########################################################## + + # # COM217 + # if mail["Subject"].contains("Spring-2014-COM-21700-004"): + # mail.move("INBOX.classes.2014-1.COM217") + # return + # if mail["From"].contains("mixable") and mail["Subject"].matches("^COM 21700"): + # mail.move("INBOX.classes.2014-1.COM217.Mixable") + # return + # # CS252 (Systems Programming) + # if piazza_topic(mail, "CS 25200"): + # mail.move("INBOX.classes.2014-1.CS252.Piazza") + # return + # # CS307 (Software Engineering) + # if is_to_or_from(mail, "dunsmore@purdue.edu") or mail["Subject"].contains("Spring-2014-CS-30700-LE1"): + # mail.move("INBOX.classes.2014-1.CS307") + # return + # # SPAN102 + # if mail["Subject"].contains("spring-2014-span-102"): + # mail.move("INBOX.classes.2014-1.SPAN102") + # return + # # STAT350 + # if is_to_or_from(mail, "ssellke@purdue.edu"): + # mail.move("INBOX.classes.2014-1.STAT350") + # return + # if piazza_topic(mail, "STAT 35000 (SELLKE)"): + # mail.move("INBOX.classes.2014-1.STAT350.Piazza") + # return + + # # Fall 2014 ############################################################ + + # # CS334 (Graphics) + # if (is_to_or_from(mail, "lin553@purdue.edu") or mail["Subject"].contains("Fall-2014-CS-33400")): + # mail.move("INBOX.classes.2014-2.CS334") + # return + # # CS354 (OS) + # if piazza_topic(mail, "CS 354"): + # mail.move("INBOX.classes.2014-2.CS354.Piazza") + # return + # # CS381 (Algo) + # if piazza_topic(mail, "CS 381"): + # mail.move("INBOX.classes.2014-2.CS381.Piazza") + # return + # # CS456 (Programming languages) + # if piazza_topic(mail, "CS 456"): + # mail.move("INBOX.classes.2014-2.CS456.Piazza") + # return + # # MA416 + # if mail["Subject"].contains("Fall-2014-MA-41600"): + # mail.move("INBOX.classes.2014-2.MA416") + # return + # # PHYS221 + # if (False + # or is_to_or_from(mail, "cui@purdue.edu") + # or is_to_or_from(mail, "shina@purdue.edu") + # or is_to_or_from(mail, "ajith@purdue.edu") + # ): + # mail.move("INBOX.classes.2014-2.PHYS221") + # return + + # # Spring 2015 ######################################################### + + # # CS352 (Compilers) + # if is_to_or_from(mail, "wjg@cs.purdue.edu"): + # mail.move("INBOX.classes.2015-1.CS352") + # return + # if piazza_topic(mail, "CS 352"): + # mail.move("INBOX.classes.2015-1.CS352.Piazza") + # return + # # CS408 (Software testing) + # if (False + # or mail["Subject"].contains("spring-2015-cs-40800") + # or is_to_or_from(mail, "li1471@purdue.edu") + # or is_to_or_from(mail, "kirby@purdue.edu") + # or is_to_or_from(mail, "webb39@purdue.edu") + # or is_to_or_from(mail, "Jkou@purdue.edu") + # or is_to_or_from(mail, "nstodda@purdue.edu") + # or is_to_or_from(mail, "aryker@purdue.edu") # TA + # ): + # mail.move("INBOX.classes.2015-1.CS408") + # return + # # CS448 (Databases) + # if piazza_topic(mail, "CS 44800"): + # mail.move("INBOX.classes.2015-1.CS448.Piazza") + # return + # if mail["Subject"].matches("CS *448"): + # mail.move("INBOX.classes.2015-1.CS448") + # return + # # ME297 (FRC) + # if (False + # or mail["Subject"].contains("[ME297]") + # or is_to_or_from(mail, "heller5@purdue.edu") + # ): + # mail.move("INBOX.classes.2015-1.ME297") + # return + # # SOC324 (Criminology) + # if mail["Subject"].contains("spring-2015-soc-32400"): + # mail.move("INBOX.classes.2015-1.SOC324") + # return + + # Spring 2015 ###############################z########################## + + # CHM 490 (History & Philosophy of Science) + if is_to_or_from(mail, "gmbodner@purdue.edu"): + mail.move("INBOX.classes.2015-2.CHM490") + return + # CS 334 (Graphics) + if ( + False + or mail["Subject"].contains("fall-2015-cs-33400-le1") + or is_to_or_from(mail, "aliaga@purdue.edu") + or is_to_or_from(mail, "abejara@purdue.edu") + ): + mail.move("INBOX.classes.2015-2.CS334") return - # CS252 (Systems Programming) - if piazza_topic(mail, "CS 25200"): - mail.move("INBOX.classes.2014-1.CS252.Piazza") + if piazza_topic(mail, "CS 334"): + mail.move("INBOX.classes.2015-2.CS334.Piazza") return - # CS307 (Software Engineering) - if is_to_or_from(mail, "dunsmore@purdue.edu") or mail["Subject"].contains("Spring-2014-CS-30700-LE1"): - mail.move("INBOX.classes.2014-1.CS307") + # CS 490 (Senior Project) + if is_to_or_from(mail, "anesen@purdue.edu"): + mail.move("INBOX.classes.2015-2.CS490") return - # SPAN102 - if mail["Subject"].contains("spring-2014-span-102"): - mail.move("INBOX.classes.2014-1.SPAN102") + if piazza_topic(mail, "CS 49000"): + mail.move("INBOX.classes.2015-2.CS490.Piazza") return - # STAT350 - if is_to_or_from(mail, "ssellke@purdue.edu"): - mail.move("INBOX.classes.2014-1.STAT350") + # MA 416 (Probability) + if mail["Subject"].contains("fall-2015-ma-41600"): + mail.move("INBOX.classes.2015-2.MA416") return - if piazza_topic(mail, "STAT 35000 (SELLKE)"): - mail.move("INBOX.classes.2014-1.STAT350.Piazza") + if piazza_topic(mail, "SELLKE 416 "): + mail.move("INBOX.classes.2015-2.MA416.Piazza") return - # Fall 2014 ############################################################ - - # CS334 (Graphics) - if (is_to_or_from(mail, "lin553@purdue.edu") or mail["Subject"].contains("Fall-2014-CS-33400")): - mail.move("INBOX.classes.2014-2.CS334") - return - # CS354 (OS) - if piazza_topic(mail, "CS 354"): - mail.move("INBOX.classes.2014-2.CS354.Piazza") - return - # CS381 (Algo) - if piazza_topic(mail, "CS 381"): - mail.move("INBOX.classes.2014-2.CS381.Piazza") + # FRC 4272 + if mail["Subject"].contains("[ME297]"): + mail.move("INBOX.classes.2015-2.FRC4272") return - # CS456 (Programming languages) - if piazza_topic(mail, "CS 456"): - mail.move("INBOX.classes.2014-2.CS456.Piazza") - return - # MA416 - if mail["Subject"].contains("Fall-2014-MA-41600"): - mail.move("INBOX.classes.2014-2.MA416") - return - # PHYS221 - if (False - or is_to_or_from(mail, "cui@purdue.edu") - or is_to_or_from(mail, "shina@purdue.edu") - or is_to_or_from(mail, "ajith@purdue.edu") - ): - mail.move("INBOX.classes.2014-2.PHYS221") - return - - # Spring 2015 ######################################################### - # CS352 (Compilers) - if is_to_or_from(mail, "wjg@cs.purdue.edu"): - mail.move("INBOX.classes.2015-1.CS352") - return - if piazza_topic(mail, "CS 352"): - mail.move("INBOX.classes.2015-1.CS352.Piazza") - return - # CS408 (Software testing) - if (False - or mail["Subject"].contains("spring-2015-cs-40800") - or is_to_or_from(mail, "li1471@purdue.edu") - or is_to_or_from(mail, "kirby@purdue.edu") - or is_to_or_from(mail, "webb39@purdue.edu") - or is_to_or_from(mail, "Jkou@purdue.edu") - or is_to_or_from(mail, "nstodda@purdue.edu") - or is_to_or_from(mail, "aryker@purdue.edu") # TA - ): - mail.move("INBOX.classes.2015-1.CS408") - return - # CS448 (Databases) - if piazza_topic(mail, "CS 44800"): - mail.move("INBOX.classes.2015-1.CS448.Piazza") - return - if mail["Subject"].matches("CS *448"): - mail.move("INBOX.classes.2015-1.CS448") - return - # ME297 (FRC) - if (False - or mail["Subject"].contains("[ME297]") - or is_to_or_from(mail, "heller5@purdue.edu") - ): - mail.move("INBOX.classes.2015-1.ME297") - return - # SOC324 (Criminology) - if mail["Subject"].contains("spring-2015-soc-32400"): - mail.move("INBOX.classes.2015-1.SOC324") - return - # Everything else ##################################################### mail.move("INBOX.ham"); -- cgit v1.2.3