diff options
author | Aaron LI <aaronly.me@gmail.com> | 2016-01-06 19:15:10 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@gmail.com> | 2016-01-06 19:15:10 +0800 |
commit | 028ab301fe80c9ed872fe8ba4be2819648e30d97 (patch) | |
tree | e3788bddd4bc9732577cde23c5c8a38824ddbc8d | |
parent | 6f2380babe7dcfb204937f0f734443a6c854106f (diff) | |
download | dotfiles-028ab301fe80c9ed872fe8ba4be2819648e30d97.tar.bz2 |
Add fish & redshift configs; Update gpg configs; Add mutt scripts
-rw-r--r-- | .config/fish/config.fish | 30 | ||||
-rw-r--r-- | .config/fish/config.local.fish | 35 | ||||
-rw-r--r-- | .config/redshift.conf | 71 | ||||
-rw-r--r-- | .gnupg/gpg-agent.conf | 4 | ||||
-rw-r--r-- | .gnupg/gpg.conf | 20 | ||||
-rwxr-xr-x | .mutt/excel2text.sh | 31 | ||||
-rwxr-xr-x | .mutt/mutt_octet_view.sh | 278 | ||||
-rwxr-xr-x | .mutt/ppt2text.sh | 23 | ||||
-rwxr-xr-x | .mutt/word2text.sh | 67 |
9 files changed, 552 insertions, 7 deletions
diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..24151d5 --- /dev/null +++ b/.config/fish/config.fish @@ -0,0 +1,30 @@ +# +# ~/.config/fish/config.fish +# +# +# Aaron LI +# 2015-09-26 +# + +# vi mode +fish_vi_mode + +set -U EDITOR vim + +## PATH +# ~/bin +if test -d $HOME/bin + set -U fish_user_paths $HOME/bin $fish_user_paths +end +# admin paths +if groups | grep -qE '\b(wheel|adm|sudo)\b' + set -U fish_user_paths $fish_user_paths /usr/local/sbin /usr/sbin /sbin +end + +# local config +set -l localconfig "$HOME/.config/fish/config.local.fish" +if test -f $localconfig + source $localconfig +end + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=fish: # diff --git a/.config/fish/config.local.fish b/.config/fish/config.local.fish new file mode 100644 index 0000000..5dab86b --- /dev/null +++ b/.config/fish/config.local.fish @@ -0,0 +1,35 @@ +# +# ~/.config/fish/config.local.fish +# +# Local configuration for fish. +# +# Aaron LI +# 2015-10-03 +# + + +## astro {{{ +# backup LD_LIBRARY_PATH settings +set -x LD_LIBRARY_PATH_BAK $LD_LIBRARY_PATH + +# heasoft +set -x HEADAS "$HOME/local/heasoft/heasoft-6.16/x86_64-unknown-linux-gnu" +function heainit + set -l hea_state (echo $PATH | tr ':' '\n' | grep 'heasoft') + if test "x$hea_state" = "x" + source $HEADAS/headas-init.fish + end + set -x LD_LIBRARY_PATH $LD_LIBRARY_PATH_BAK +end + +# ciao +set -x CIAO_PATH "$HOME/local/ciao/ciao-4.6" +function ciaoinit + heainit + source "$CIAO_PATH/bin/ciao.fish" $argv + set -x CIAO_LD_LIBRARY_PATH "$ASCDS_INSTALL/ots/lib" +end +## astro }}} + + +# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=fish: # diff --git a/.config/redshift.conf b/.config/redshift.conf new file mode 100644 index 0000000..cbaded4 --- /dev/null +++ b/.config/redshift.conf @@ -0,0 +1,71 @@ +;; +;; ~/.config/redshift.conf +;; redshift configuration +;; https://github.com/jonls/redshift +;; +;; Credits: http://jonls.dk/redshift/ +;; +;; 2015/06/30 +;; + +;; Spaces not allowed before and after the '=' + +[redshift] +; Set the day and night screen temperatures +temp-day=5500 +temp-night=3700 + +; Enable/Disable a smooth transition between day and night +; 0 will cause a direct change from day to night screen temperature. +; 1 will gradually increase or decrease the screen temperature. +transition=1 + +; Set the screen brightness. Default is 1.0. +;brightness=0.9 +; It is also possible to use different settings for day and night +; since version 1.8. +brightness-day=0.7 +brightness-night=0.5 + +; Set the screen gamma (for all colors, or each color channel +; individually) +;gamma=0.8 +;gamma=0.8:0.7:0.8 +; This can also be set individually for day and night since +; version 1.10. +;gamma-day=0.8:0.7:0.8 +;gamma-night=0.6 + +; Set the location-provider: 'geoclue', 'geoclue2', 'manual' +; type 'redshift -l list' to see possible values. +; The location provider settings are in a different section. +location-provider=manual + +; Set the adjustment-method: 'randr', 'vidmode' +; type 'redshift -m list' to see all possible values. +; 'randr' is the preferred method, 'vidmode' is an older API. +; but works in some cases when 'randr' does not. +; The adjustment method settings are in a different section. +adjustment-method=randr + +; Configuration of the location-provider: +; type 'redshift -l PROVIDER:help' to see the settings. +; ex: 'redshift -l manual:help' +; Keep in mind that longitudes west of Greenwich (e.g. the Americas) +; are negative numbers. +[manual] +; Shanghai: 31.2, 121.5 +; Shaoyang: 27.2, 111.5 +lat=31.2 +lon=121.5 + +; Configuration of the adjustment-method +; type 'redshift -m METHOD:help' to see the settings. +; ex: 'redshift -m randr:help' +; In this example, randr is configured to adjust screen 1. +; Note that the numbering starts from 0, so this is actually the +; second screen. If this option is not specified, Redshift will try +; to adjust _all_ screens. +[randr] +;screen=1 + diff --git a/.gnupg/gpg-agent.conf b/.gnupg/gpg-agent.conf index ca503bd..35d2924 100644 --- a/.gnupg/gpg-agent.conf +++ b/.gnupg/gpg-agent.conf @@ -15,7 +15,7 @@ pinentry-program /usr/bin/pinentry-gtk-2 no-grab -# default timeout of the passphrase (10 minutes) -default-cache-ttl 600 +# default timeout of the passphrase (60 minutes) +default-cache-ttl 3600 # vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=gpg: # diff --git a/.gnupg/gpg.conf b/.gnupg/gpg.conf index 6db3bf6..258c10e 100644 --- a/.gnupg/gpg.conf +++ b/.gnupg/gpg.conf @@ -13,7 +13,7 @@ # # Weitian LI <liweitianux@gmail.com> # Created: 2014/06/12 -# Updated: 2015/01/19 +# Updated: 2015/08/19 ##################################################################### #----------------------------- @@ -22,7 +22,7 @@ # The default key to sign with. If this option is not used, the default key is # the first key found in the secret keyring -default-key 0xF00D615C9984147B450F56EAF81BF4535F26EBF6 +default-key 0xAC3464FADAAE632186099CA6240E2A635D72729A #----------------------------- # behavior @@ -68,8 +68,8 @@ use-agent # This is the server that --recv-keys, --send-keys, and --search-keys will # communicate with to receive keys from, send keys to, and search for keys on -keyserver hkp://pool.sks-keyservers.net -#keyserver hkps://hkps.pool.sks-keyservers.net +#keyserver hkp://pool.sks-keyservers.net +keyserver hkps://hkps.pool.sks-keyservers.net # Provide a certificate store to override the system default # Get this from https://sks-keyservers.net/sks-keyservers.netCA.pem @@ -83,7 +83,8 @@ keyserver hkp://pool.sks-keyservers.net # IsolateDestAddr #keyserver-options http-proxy=socks5-hostname://127.0.0.1:9050 # Don't leak DNS, see https://trac.torproject.org/projects/tor/ticket/2846 -keyserver-options no-try-dns-srv +# XXX: unknown to gnupg 2.1.7 +#keyserver-options no-try-dns-srv # When using --refresh-keys, if the key in question has a preferred keyserver # URL, then disable use of that preferred keyserver to refresh the key from @@ -93,6 +94,15 @@ keyserver-options no-honor-keyserver-url # the keyserver as revoked keyserver-options include-revoked +# Automatic retrieve keys from a keyserver when verifying signatures made by +# keys that are not on the local keyring. +# NOTE: This option makes a "web bug" like behavior possible. +# Keyserver operators can see which keys you rquest, so by sending +# you a message signed by a brand new key (which you naturally will +# not have on your local keyring), the operator can tell both your +# IP address and the time when you verified the signature. +keyserver-options auto-key-retrieve + #----------------------------- # algorithm and ciphers #----------------------------- diff --git a/.mutt/excel2text.sh b/.mutt/excel2text.sh new file mode 100755 index 0000000..c3d0f14 --- /dev/null +++ b/.mutt/excel2text.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# excel2text - convert MS Excel files to ASCII text +# +# Written by Gary Johnson <garyjohn@spk.agilent.com>. +# +# Modification History: +# 2003-02-19 +# Changed the name xlHtml to xlhtml to match the xlhtml-0.5 +# release. + +prog=${0##*/} + +if [ $# -ne 1 ] +then + echo "Usage: $prog file" >&2 + exit 2 +fi + +xlhtml -te "$1" | +perl -pe 's/>-{21,}</><HR></g' | # This replaces long lines of + # hyphens with HTML <HR> tags so + # that these lines adapt to the + # width of the cell. "21" is a + # value that works for the + # tables I'm sent. +w3m -dump -T text/html | +perl -pe ' + s/\xa0/ /gs; # Change A0 spaces to ASCII + # spaces. +' diff --git a/.mutt/mutt_octet_view.sh b/.mutt/mutt_octet_view.sh new file mode 100755 index 0000000..a1e6c6f --- /dev/null +++ b/.mutt/mutt_octet_view.sh @@ -0,0 +1,278 @@ +#!/bin/sh +# @(#) mutt_octet_view $Revision: 1.1 $ + +# mutt_octet_view - select octet-stream e-mail attachment viewer +# Copyright (C) 1997,1998,1999,2000 David A Pearson +# Copyright (C) 2000-2001 Gary A. Johnson +# +# 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 2 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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Mutt_octet_view is derived from Dave Pearson's mutt.octet.filter +# script (http://www.hagbard.demon.co.uk/archives/mutt.octet.filter). +# Mutt.octet.filter was designed to convert octet-stream e-mail +# attachments to text for use with mutt's auto_view feature. +# Mutt_octet_view extends this capability to use different viewers from +# mutt's attachment menu, including graphical viewers if X is available. +# +# To use mutt_octet_view, put the following lines in your mailcap file: +# +# application/octet-stream; mutt_octet_view -x %s; test=RunningX +# application/octet-stream; mutt_octet_view -v %s +# application/octet-stream; mutt_octet_view %s; copiousoutput +# +# and the following line in your muttrc file: +# +# auto_view application/octet-stream +# +# Mutt_octet_view is not a viewer itself; it only selects external +# viewers based on the attachments' file name suffixes (extensions). +# In addition to any viewers, you will need a copy of the author's +# mutt_bgrun script in order to run X viewers in the background. +# +# Please direct any comments to: +# +# Gary Johnson <garyjohn@spk.agilent.com> +# + + +ShowTAR() +{ + tar tvvf "$1" 2> /dev/null +} + +ShowTGZ() +{ + tar tzvvf "$1" 2> /dev/null +} + +ShowTBZ() +{ + bzip2 -dc "$1" | tar -tvv -f- 2> /dev/null +} + +ShowGZIP() +{ + gzip -dc "$1" 2> /dev/null +} + +ShowZIP() +{ + unzip -l "$1" 2> /dev/null +} + +ShowARJ() +{ + unarj l "$1" 2> /dev/null +} + +ShowVCard() +{ + cat "$1" | mutt.vcard.filter +} + +ShowTIF() +{ + tiffinfo "$1" +} + +ShowObject() +{ + nm "$1" +} + +ShowHTML() +{ + w3m -dump "$1" +} + +ShowPDF() +{ + pdftotext "$1" - +} + +Show() +{ + case "$Mode" in + SHOW) + if [ "$2" ] + then + $2 "$1" + elif [ "$3" -o "$4" ] + then + echo "[-- $Prog: file type is unsupported for autoview (use 'v' to view this part) --]" + else + echo "[-- $Prog: file type is unsupported --]" + fi + ;; + VIEW) + if [ "$3" ] + then + $3 "$1" + elif [ "$2" ] + then + $2 "$1" + else + echo "$Prog: file type is unsupported" >&2 + exit 1 + fi + ;; + XVIEW) + if [ "$4" ] + then + mutt_bgrun $4 "$1" || $4 "$1" + elif [ "$3" ] + then + $3 "$1" + elif [ "$2" ] + then + $2 "$1" + else + echo "$Prog: file type is unsupported" >&2 + exit 1 + fi + ;; + *) echo "$Prog: internal error: invalid Mode $Mode" >&2 + exit 2;; + esac +} + +# Initialize variables + +Prog=$(basename "$0") +Mode=SHOW + +# Check option arguments + +while [ $# -gt 0 ] +do + case "$1" in + -t) Mode=SHOW; shift;; + -v) Mode=VIEW; shift;; + -x) Mode=XVIEW; shift;; + -*) echo "$Prog: invalid option $1" >&2; exit 2;; + *) break;; + esac +done + +# Check file argument + +if [ $# -ne 1 ] +then + echo "usage: $Prog [-t|-v|-x] file" + exit 2 +fi + +File=$1 + +# Process file + +# The behavior of mutt_octet_view is governed primarily by the 'Show' +# function, the option argument, and the table below. 'Show' searches +# its arguments for a command that it can use to display File. It +# begins in the table column specified by the option argument -t (the +# default), -v or -x, and searches to the left until it finds a command +# (non-empty string), which it executes. Commands in the right-most +# column are executed in the background and are left to handle their own +# output. Commands in the other two columns are executed in the +# foreground and send their output to stdout. +# +# Here are some examples. +# +# Autoview Text View X View +# (from (from (from +# index attachment attachment +# menu, menu, menu, +# in-line) foreground) background) +# (-t) (-v) (-x) +# ----------- ----------- ----------- +# Func1 "" "" Func1 will be used to display +# file in all cases. This is +# useful when all that is +# required to display the file is +# a simple text transformation. +# +# "" Func2 "" The file will not be displayed +# in the pager output from the +# index menu. Func2 will be used +# to display the file from the +# attachment menu. This is +# useful when the file is to be +# displayed as text, but is not +# normally desired to view it +# along with the rest of the +# message. +# +# "" "" Func3 The file contains graphical +# material that cannot be viewed +# as text. Func3 will be used to +# display the file only from the +# attachment menu and only when X is +# available. Func3 will be run in +# the background so that the user +# can continue to use the mailer +# while the file is displayed. +# +# "" Func2 Func3 The file contents are not +# displayed in-line along with +# the rest of the message because +# the file is typically large. +# Func2 has only text output and +# is used when only a terminal is +# available for output. Func3 +# produces a nicer display when X +# is available. + +case "$File" in + # Autoview Text View X View + # (from (from (from + # index attachment attachment + # menu, menu, menu, + # in-line) foreground) background) + # (-t) (-v) (-x) + # ----------- ----------- ------------- +*.arj | *.ARJ ) Show "$File" "" ShowARJ "" ;; +*.doc | *.DOC ) Show "$File" word2text word2text qvpview ;; +*.gif | *.GIF ) Show "$File" "" "" xv ;; +*.htm | *.HTM ) Show "$File" ShowHTML w3m mutt_netscape ;; +*.html | *.HTML ) Show "$File" ShowHTML w3m mutt_netscape ;; +*.jpeg | *.JPEG ) Show "$File" "" "" xv ;; +*.jpg | *.JPG ) Show "$File" "" "" xv ;; +*.log | *.LOG ) Show "$File" cat less "" ;; +*.o ) Show "$File" "" ShowObject "" ;; +*.pdf | *.PDF ) Show "$File" "" ShowPDF acroread ;; +*.ppt | *.PPT ) Show "$File" "" "" qvpview ;; +*.ps | *.PS ) Show "$File" "" "" ghostview ;; +*.rtf | *.RTF ) Show "$File" "" rtf2text qvpview ;; +*.tar ) Show "$File" "" ShowTAR "" ;; +*.tar.bz2 ) Show "$File" "" ShowTBZ "" ;; +*.tar.gz ) Show "$File" "" ShowTGZ "" ;; +*.tar.Z ) Show "$File" "" ShowTGZ "" ;; +*.tar.z ) Show "$File" "" ShowTGZ "" ;; +*.tbz2 ) Show "$File" "" ShowTBZ "" ;; +*.tgz ) Show "$File" "" ShowTGZ "" ;; +*.tif | *.TIF ) Show "$File" "" ShowTIF xv ;; +*.txt | *.TXT ) Show "$File" cat less "" ;; +*.url | *.URL ) Show "$File" cat w3m "" ;; +*.vcf ) Show "$File" "" ShowVCard "" ;; +*.xls | *.XLS ) Show "$File" excel2text excel2text qvpview ;; +*.Z ) Show "$File" "" ShowGZIP "" ;; +*.z ) Show "$File" "" ShowGZIP "" ;; +*.zip | *.ZIP ) Show "$File" "" ShowZIP "" ;; +*.gz ) Show "$File" "" ShowGZIP "" ;; + # The *.gz entry must follow any other entries ending in + # .gz. +* ) echo "$Prog: file type is unsupported" >&2; exit 1 ;; + +esac diff --git a/.mutt/ppt2text.sh b/.mutt/ppt2text.sh new file mode 100755 index 0000000..43d22f4 --- /dev/null +++ b/.mutt/ppt2text.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# ppt2text - convert MS PowerPoint files to ASCII text +# +# Written by Gary Johnson <garyjohn@spk.agilent.com>. +# +# Modification History: +# 2003-02-19 +# Changed the name pptHtml to ppthtml to match the xlhtml-0.5 +# release. + +prog=${0##*/} + +if [ $# -ne 1 ] +then + echo "Usage: $prog file" >&2 + exit 2 +fi + +ppthtml $1 | +w3m -dump -T text/html | +perl -pe 's/\xa0/ /g' # Change A0 spaces to ASCII + # spaces. diff --git a/.mutt/word2text.sh b/.mutt/word2text.sh new file mode 100755 index 0000000..fe9682d --- /dev/null +++ b/.mutt/word2text.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# +# word2text - convert MS Word files to ASCII text +# +# SYNOPSIS +# word2text file +# +# DESCRIPTION +# Word2text uses wvHtml, w3m and some perl glue to convert the MS +# Word file specified by the argument to ASCII text on stdout. +# +# wvHtml converts MS Word files to HTML, but is intended to be +# used with a graphical browser such as Netscape Navigator, so it +# converts certain graphical elements to image files and +# corresponding <img> tags that the browser can render. Since +# this script uses a text based browser, it uses perl to eliminate +# these <img> tags. +# +# Compared to Quick View Plus (qvpview), the rendering of MS Word +# documents done by word2text is usually more accurate. Qvpview +# doesn't render unrecognized characters well, if at all. It also +# renders numbered lists as bullet lists. +# +# Compared to the plain text translations that some people include +# in their e-mail along with the original MS Word attachments, the +# rendering done by word2text is usually more readable: vertical +# spacing between paragraphs and list items is better and the +# adjustment of text within paragraphs is better. +# +# BUGS +# wvHtml occasionally dumps core. +# With the wv-0.7.4 release, some unnumbered lists are rendered as +# numbered. +# +# AUTHOR +# Gary A. Johnson +# <garyjohn@spk.agilent.com> +# +# REVISION HISTORY +# 2003-05-31 +# Between wv-0.5.42 and wv-0.7.4, wvHtml changed to insert +# a <p> tag between each <li> tag and the following text, +# causing the list-item text to start on the line +# following the list-item bullet or number. A perl +# expression was added to this script to fix the problem. +# 2003-02-19 +# The command-line arguments to wvHtml changed, requiring +# the output file name as well as the input file name. +# Therefore, '-' (stdout) was added to the command as the +# output file name. + +wvHtml "$1" - 2> /dev/null | +perl -0777 -p -e ' + s|<img .*?>||gs; # Delete img tags. + s|(<li.*?>)\s*<p>|\1|gs; # Remove <p> tags immediately + # following <li> tags. (This + # problem appeared somewhere + # between wv-0.5.42 and + # wv-0.7.4.) +' | +w3m -dump -T text/html | +perl -p -e ' + s/\n\s*\n/\n\n/gs; # Delete extra whitespace + # between lines. + s/\xa0/ /gs; # Change A0 spaces to ASCII + # spaces. +' |