Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

8.8 KiB

Cray Configuration

Cray specific

~/.emacs.d/local.el

(defun cray/get-bugs ()
 (with-current-buffer (current-buffer)
   (setq input (save-restriction (widen)
                                 (buffer-substring-no-properties
                                  (point-min) (point-max))))
   (setq bugline "Bugs Affected[:] .*")
   (if (s-match bugline input)
       (mapcar 'car (s-match-strings-all
                     "[7-9][[:digit:]]\\{5\\}" (car (mapcar 'car (s-match-strings-all bugline input)))))
     '("NO BUGS?")
     )
   )
 )
(defun cray/get-bugzilla-cmds ()
 (loop for bug in (cray/get-bugs)
       collect (concat
                "env PYTHONWARNINGS='ignore:Unverified HTTPS request' bugzilla --nosslverify --bugzilla=https://bugzilla.us.cray.com/xmlrpc.cgi query --outputformat='%{summary}' --bug_id " bug)
       )
 )
(defun cray/get-descriptions ()
 (loop for out in (cray/get-bugzilla-cmds)
       collect (shell-command-to-string out))
 )

~/.gnus

Use gnus in emacs for email. Outside of normal emacs since its easier.

  (use-package gnus
    :ensure t
    :config
    (progn
      (setq user-full-name "Mitch Tishmack"
            user-mail-address "mtishmack@cray.com")
      (setq gnus-select-method '(nnnil ""))
      (setq gnus-secondary-select-methods '((nnml "")))
      (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
      (setq gnus-mime-display-multipart-related-as-mixed t)
      (setq gnus-auto-select-first nil)
      (setq gnus-summary-display-arrow nil)
      (setq nnmail-split-methods 'nnmail-split-fancy)
      (setq gnus-nntp-server nil
                 gnus-read-active-file nil
                 gnus-save-newsrc-file nil
                 gnus-read-newsrc-file nil
                 gnus-check-new-newsgroups nil)
           (setq nnml-directory "~/.emacs.d/mail")
           (setq message-directory "~/.emacs.d/mail")

           (setq gnus-select-method
                 '(nnimap "outlook"
                          (nnimap-address "outlook.office365.com")
                          (nnimap-server-port 993)))

           (setq-default
            gnus-summary-line-format "[%U%R%z]  %(%&user-date;  %-15,15f  %B%s%)\n"
            gnus-user-date-format-alist '((t . "%Y-%m-%d"))
            gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references
            gnus-sum-thread-tree-root ""
            gnus-sum-thread-tree-false-root ""
            gnus-sum-thread-tree-indent " "
            gnus-sum-thread-tree-single-indent ""
            gnus-sum-thread-tree-single-leaf "└─>"
            gnus-sum-thread-tree-vertical "│"
            gnus-sum-thread-tree-leaf-with-other "├─>")
           (setq gnus-thread-sort-functions
                 '((not gnus-thread-sort-by-date)
                   (not gnus-thread-sort-by-number)))
           (setq gnus-use-cache t)
           (setq gnus-use-adaptive-scoring t)
           (setq gnus-save-score t)
           (setq nnmail-split-fancy
        '(|
            ("From" "\\(root\\|cron\\)@localhost" "system")
            "normal"))
           )
    )

~/bin/essh

Expect ssh, to aide login to smw's etc..

#!/usr/bin/expect
set prompt "> "
set password [lindex $argv 1]
set connstr [lindex $argv 0]

if {$argc > 2} {
    eval spawn ssh -q $connstr "[lrange $argv 2 end]"
    set timeout 3600
    expect {
        timeout {
            puts "Command took too long"
            exit 1
        }

        "yes/no" {
            send "yes\r"
            exp_continue
        }

        "assword:" {
            send -- "$password\r"
            exp_continue
        }
    }
} else {
    spawn ssh -q $connstr
    set timeout 5
    expect {
        timeout {
            puts "Connection timed out"
            exit 1
        }

        "yes/no" {
            send "yes\r"
            exp_continue
        }

        "assword:" {
            send -- "$password\r"
            exp_continue
        }

        "$prompt" {
            interact
        }
    }
}

~/bin/escp

Similar to the above only for scp.

#!/usr/bin/expect
set prompt "> "
set password [lindex $argv 0]

if {$argc > 2} {
    eval spawn scp -q "[lrange $argv 1 end]"
    set timeout 3600
    expect {
        timeout {
            puts "Command took too long"
            exit 1
        }

        "yes/no" {
            send "yes\r"
            exp_continue
        }

        "assword:" {
            send -- "$password\r"
            exp_continue
        }
    }
}

~/bin/flushdns

For some reason this sometimes needs to happen, stupid work dns.

#!/bin/sh

set +e
dscacheutil -flushcache
sudo killall -HUP mDNSResponder
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
exit $?

~/bin/tomod

#!/usr/bin/env sh
#-*-mode: Shell-script; coding: utf-8;-*-
export script=$(basename "$0")
export dir=$(cd "$(dirname "$0")"; pwd)
export iam=${dir}/${script}

remote=cfosbldvm01

export PATH=/usr/local/brew/10.10/bin:~/bin:${PATH}
branch=$(git rev-parse --abbrev-ref HEAD)

if [ $? -ne 0 ]; then
  echo not on a branch or in a git repo
  exit 2
fi

base_git="$(pwd)"
opwd="${base_git}"

while true; do
  if [ -d ".git" ]; then
      base_git="$(pwd)"
      break
  fi

  if [ "$(pwd)" == "/" ]; then
      echo "No .git base directory found from ${opwd}"
      exit 2
  fi
  ((count=$count+1))
  cd ..
done

svn_url=$(git svn info --url)
remote_svn="/notbackedup/users/mtishmack/mod_data/${branch}"

ssh $remote "module load cpkg sdev craysvn; rm -fr ${remote_svn}; mkdir -p ${remote_svn} && svn co ${svn_url} ${remote_svn} > /dev/null 2>&1;"
echo "rsyncing local git branch to ${remote}:${remote_svn}"

rsync \
    --stats \
    --checksum \
    -avz \
    --hard-links \
    --exclude=.git \
    --delete-excluded \
    --delete \
    --filter="-rs_.svn" \
    --filter="-ss_covhtml" \
    --filter="-ss_dev.yml" \
    --filter="-ss_.gitignore" \
    --filter="-ss_*.log" \
    --filter="-ss_.\#*" \
    --filter="-ss_*.swp" \
    --filter="-ss_*.pyc" \
    --filter="-ss_venv" \
    --filter="-ss_testdirs" \
    --filter="-ss_testfiles" \
    --filter="-ss_.*.git.*" \
    --filter="-ss_*.o" \
    --filter="-ss_*.o.cmd" \
    --filter="-ss_*.ko" \
    --filter="-ss_*.ko.cmd" \
    --filter="-ss_*.tmp_versions" \
    "${base_git}/" "${remote}:${remote_svn}"
echo "done rsyncing ${base_git} to ${remote}:${remote_svn}"

~/bin/towip

#!/usr/bin/env sh
#-*-mode: Shell-script; coding: utf-8;-*-
export script=$(basename "$0")
export dir=$(cd "$(dirname "$0")"; pwd)
export iam=${dir}/${script}

remote=cfosbld01

export PATH=/usr/local/brew/10.10/bin:~/bin:${PATH}
branch=$(git rev-parse --abbrev-ref HEAD)

if [ $? -ne 0 ]; then
  echo not on a branch or in a git repo
  exit 2
fi

base_git="$(pwd)"
opwd="${base_git}"

while true; do
  if [ -d ".git" ]; then
      base_git="$(pwd)"
      break
  fi

  if [ "$(pwd)" == "/" ]; then
      echo "No .git base directory found from ${opwd}"
      exit 2
  fi
  ((count=$count+1))
  cd ..
done

svn_url=$(git svn info --url)
remote_svn="/notbackedup/users/mtishmack/wip-dws"

ssh $remote "module load cpkg sdev craysvn; rm -fr ${remote_svn}; mkdir -p ${remote_svn} && svn co ${svn_url} ${remote_svn} > /dev/null 2>&1;"

echo "rsyncing local git branch to ${remote}:${remote_svn}"

rsync \
    --progress \
    --checksum \
    -avz \
    --hard-links \
    --exclude=.git \
    --delete-excluded \
    --delete \
    --filter="-rs_.svn" \
    --filter="-ss_covhtml" \
    --filter="-ss_dev.yml" \
    --filter="-ss_.gitignore" \
    --filter="-ss_*.log" \
    --filter="-ss_.\#*" \
    --filter="-ss_*.swp" \
    --filter="-ss_*.pyc" \
    --filter="-ss_*.o" \
    --filter="-ss_*.o.cmd" \
    --filter="-ss_*.tmp_versions" \
    --filter="-ss_venv" \
    --filter="-ss_testdirs" \
    --filter="-ss_testfiles" \
    --filter="-ss_.*.git.*" \
    "${base_git}/" "${remote}:${remote_svn}"
echo "done rsyncing ${base_git} to ${remote}:${remote_svn}"