.profile (4877B)
1 MANPATH=/usr/local/share/man:$MANPATH 2 3 export LANG=en_US.UTF-8 4 export LC_ALL=en_US.UTF-8 5 export EDITOR=vi 6 export PAGER="less -i" 7 export FCEDIT="$EDITOR" 8 export TERMINAL=x-terminal-emulator 9 export BROWSER=surf-open.sh 10 export BIB="$HOME/articles/own/BIBnew.bib" 11 export SFEED_PLUMBER_INTERACTIVE=1 12 13 umask 022 14 15 GPG_TTY=$(tty) 16 export GPG_TTY 17 18 alias e='$EDITOR' 19 alias c=clear 20 alias r='fc -s' 21 alias rr='_c="$(tail -2 $HISTFILE | head -1)" && echo "$_c" && doas sh -ec "$_c"' 22 alias g=git 23 alias ytdl='youtube-dl --write-sub --write-auto-sub --sub-lang="en,da" --embed-subs --add-metadata --format="bestvideo[height<=?1080][fps<=?30]+bestaudio/best[height<=?1080][fps<=?30]"' 24 25 f() { 26 $EDITOR "$(find "${1:-.}" -type f | fzy -l 25)" 27 } 28 29 if [ -x /usr/bin/doas ]; then 30 alias se='doas $EDITOR' 31 alias mi="doas make install" 32 else 33 alias se='sudo $EDITOR' 34 alias doas=sudo 35 alias mi="sudo make install" 36 fi 37 38 alias cg='c "$(git rev-parse --show-toplevel)"' # cd under git repo 39 40 h() { 41 eval $(tail -r "$HISTFILE" | fzy -l 25) 42 } 43 44 o() { 45 if [ "$#" -eq 0 ] || [ -d "$1" ]; then 46 target="$(find "${1:-.}" | fzy -l 25)" || return 1 47 if [ -f "$target" ]; then 48 plumb "$target" 49 elif [ -d "$target" ]; then 50 cd "$target" 51 else 52 echo "unknown target type" >&2 53 fi 54 else 55 for t in "$@"; do 56 plumb "$t" 57 done 58 fi 59 } 60 61 alias ls='ls -p'; unalias ls 62 alias ls='ls -hF' 63 alias l='ls' 64 alias la='l -a' 65 alias ll='l -l' 66 alias lo='l -alo' 67 68 alias dot='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' 69 create_repo() { 70 user="git" 71 host="src.adamsgaard.dk" 72 if [ $# -lt 1 ]; then 73 printf 'usage: create_repo name\n' >&2 74 return 1 75 fi 76 if ssh "${user}@${host}" "./create-repo.sh ${1}"; then 77 printf 'make public? [Y/n] ' 78 read 79 case "$REPLY" in 80 N|n) ssh "${user}@${host}" "rm ${1}/git-daemon-export-ok";; 81 esac 82 83 if [ -f .git/config ]; then 84 printf 'add as remote origin? [Y/n] ' 85 read 86 case "$REPLY" in 87 N|n) return 0;; 88 *) 89 git remote add origin "${user}@${host}:${1}" 90 b="$(git branch | awk '{print $2}')" 91 printf 'push to remote branch "%s"? [Y/n] ' "$b" 92 read 93 case "$REPLY" in 94 N|n) return 0;; 95 *) git push --set-upstream origin "$b";; 96 esac;; 97 esac 98 fi 99 fi 100 } 101 102 alias m='make CFLAGS="${CFLAGS} -march=native -O3 -pipe"' 103 alias mw='make CFLAGS="${CFLAGS} -Wall -Wextra -pedantic -std=c99 -g" LDFLAGS="${LDFLAGS} -g"' 104 alias mc='make clean' 105 alias me='make edit' 106 107 alias nt='nohup $TERMINAL tmux >/dev/null 2>&1 &' 108 109 alias date-utc='TZ=UTC date' 110 alias date-denmark='TZ=Europe/Copenhagen date' 111 alias date-eastern='TZ=US/Eastern date' 112 alias date-pacific='TZ=US/Pacific date' 113 alias date-mountain='TZ=US/Mountain date' 114 alias date-central='TZ=US/Central date' 115 alias date-alaska='TZ=US/Alaska date' 116 alias date-uk='TZ=Europe/London date' 117 alias date-israel='TZ=Israel date' 118 119 alias w3m='w3m -B' 120 alias w3mtor='torsocks w3m -B "$@"' 121 ddg() { 122 w3m "https://duckduckgo.com/lite?q=$*&fd=-1" 123 } 124 sacc() { 125 if [ $# -eq 0 ]; then 126 /usr/local/bin/sacc gopher://adamsgaard.dk/1/tmp/bookmark.gph 127 else 128 /usr/local/bin/sacc "$@" 129 fi 130 } 131 132 alias wanip='hurl gopher://bitreich.org/0/ip' 133 #weather() { curl "wttr.in/?m"; } 134 135 t_add() { transmission-remote --add --download-dir "$PWD" --encryption-required "$@"; } 136 t_list() { transmission-remote --list; } 137 t_remove() { transmission-remote --torrent "$@" --remove; } 138 t_remove_all() { transmission-remote -tall --remove; } 139 t_stop() { transmission-remote --torrent "$@" --stop; } 140 t_stop_done() { 141 for id in $(t_list | grep -v ETA | grep Done | awk '{ print $1 }' | tr '\n' ','); do 142 t_stop "$id" 143 done 144 } 145 146 randomfile() { 147 printf '%s\n' "$(find "${@:-.}" -type f -maxdepth 1 | sort -R | head -1)" 148 } 149 150 randomman() { 151 plumb "$(randomfile /usr/share/man/man[23567])" 152 } 153 alias or='plumb "$(randomfile)"' 154 if test -d /usr/local/share/doc/posix/man; then 155 alias pman='man -M /usr/local/share/doc/posix/man' 156 alias papropos='apropos -M /usr/local/share/doc/posix/man' 157 alias pwhatis='whatis -M /usr/local/share/doc/posix/man' 158 fi 159 160 video_screenshot() { 161 ffmpeg -i "$1" -frames:v 1 "${1%.*}.jpg" 162 } 163 164 alias julia-fast='julia --procs 1 --optimize=3 --math-mode=fast' 165 166 ot() { 167 d="${1:-.}" 168 if ! test -r "${d}/tags"; then 169 ctags_recurse "${d}" 170 fi 171 vi -t "$(cat "${d}/tags" | fzy | cut -f 1)" 172 } 173 174 addtopath() { 175 for d in "$@"; do 176 if [ -d "$d" ]; then 177 if ! printf %s "${PATH}" | grep -q "${d}:"; then 178 PATH="${d}:${PATH}" 179 fi 180 fi 181 done 182 } 183 184 sourcepath() { 185 for p in "$@"; do 186 if [ -f "$p" ]; then 187 . "$p" 188 fi 189 done 190 } 191 192 addtopath /usr/local/cuda/bin /usr/local/gcc-8.3.0/bin 193 #addtopath ~/.local/pism-stable-install/bin 194 addtopath ~/.local/pism-dev-install/bin 195 addtopath ~/.local/bin 196 addtopath /usr/local/heirloom-doctools/bin 197 MANPATH=/usr/local/heirloom-doctools/man:$MANPATH 198 addtopath /usr/heirloom/bin/ucb 199 MANPATH=/usr/heirloom/share/man:$MANPATH 200 sourcepath /com/Modules/default/init/sh 201 202 ENV=$HOME/.kshrc 203 export PATH HOME TERM ENV MANPATH