dot

packages and services management
Log | Files | Refs | README

commit b886149f54cee9999f47366e744d254d65141f9e
parent 0e1433a199c7448b9a4566b2cd41ef6f6143cd50
Author: sshbio <jd@ssh.bio>
Date:   Tue, 23 Aug 2016 01:02:06 +0200

Added fzy, better than both fzf and vis-menu

Diffstat:
Dbin/armv7l/mbsync | 0
Dbin/armv7l/s-nail | 0
Dbin/armv7l/vis-clipboard | 104-------------------------------------------------------------------------------
Dbin/armv7l/vis-menu | 0
Dbin/armv7l/vis-open | 64----------------------------------------------------------------
Dbin/attach | 36------------------------------------
Dbin/feeds | 191-------------------------------------------------------------------------------
Dbin/run | 63---------------------------------------------------------------
Dcgo/build.sh | 3---
Ddoc/feeds/read | 32--------------------------------
Mdvtm/config.h | 23++++++-----------------
Afzy/build.sh | 3+++
Dicat/build.sh | 9---------
Dluarocks/build.sh | 11-----------
Dpkg-config/build.sh | 4----
Dpopcorntime/build.sh | 9---------
Drirc/build.sh | 11-----------
Drirc/config.h | 14--------------
Rdoc/agenda -> shell/.cache/agenda | 0
Rdoc/.cache/bkm -> shell/.cache/bkm | 0
Rdoc/todo -> shell/.cache/todo | 0
Ashell/.config/feeds/read | 33+++++++++++++++++++++++++++++++++
Rdoc/feeds/urls -> shell/.config/feeds/urls | 0
Mshell/.profile | 20+++++++++++---------
Rbin/beep-music -> shell/bin/adagio | 0
Rbin/agenda -> shell/bin/agenda | 0
Ashell/bin/attach | 30++++++++++++++++++++++++++++++
Rbin/bkm -> shell/bin/bkm | 0
Rbin/blawk -> shell/bin/blawk | 0
Rbin/comment -> shell/bin/comment | 0
Rbin/dna -> shell/bin/dna | 0
Rbin/drawk -> shell/bin/drawk | 0
Ashell/bin/feeds | 193+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rbin/fig -> shell/bin/fig | 0
Rbin/headline -> shell/bin/headline | 0
Rbin/irc -> shell/bin/irc | 0
Rbin/lsync -> shell/bin/lsync | 0
Rbin/peax -> shell/bin/peax | 0
Rbin/piano -> shell/bin/piano | 0
Ashell/bin/run | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rbin/src -> shell/bin/src | 0
Rbin/todo -> shell/bin/todo | 0
Rbin/www -> shell/bin/www | 0
Dsmu/build.sh | 3---
Dvim/.vimrc | 134-------------------------------------------------------------------------------
Mvis/build.sh | 9---------
46 files changed, 339 insertions(+), 723 deletions(-)

diff --git a/bin/armv7l/mbsync b/bin/armv7l/mbsync Binary files differ. diff --git a/bin/armv7l/s-nail b/bin/armv7l/s-nail Binary files differ. diff --git a/bin/armv7l/vis-clipboard b/bin/armv7l/vis-clipboard @@ -1,104 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2016 Richard Burke, ISC licensed - -vc_fatal() { - echo "$@" >&2 - exit 1 -} - -vc_usage() { - vc_fatal "`basename $0` [--usable|--copy|--paste]" -} - -vc_determine_command() { - if [ -n "$DISPLAY" ]; then - for c in xclip xsel; do - if type "$c" >/dev/null 2>&1; then - echo "$c" - return 0 - fi - done - elif type pbcopy >/dev/null 2>&1; then - echo 'mac' - return 0 - elif [ -c /dev/clipboard ]; then - echo 'cygwin' - return 0 - fi - - return 1 -} - -vc_usable() { - if vc_determine_command >/dev/null 2>&1; then - exit 0 - fi - - exit 1 -} - -vc_copy() { - COPY_CMD="`vc_determine_command 2>/dev/null`" - - if [ $? -ne 0 ] || [ -z "$COPY_CMD" ]; then - vc_fatal 'System clipboard not supported' - fi - - vc_${COPY_CMD}_copy - - exit $? -} - -vc_paste() { - PASTE_CMD="`vc_determine_command 2>/dev/null`" - - if [ $? -ne 0 ] || [ -z "$PASTE_CMD" ]; then - vc_fatal 'System clipboard not supported' - fi - - vc_${PASTE_CMD}_paste - - exit $? -} - -vc_xsel_copy() { - xsel -bi -} - -vc_xsel_paste() { - xsel -bo -} - -vc_xclip_copy() { - xclip -selection clipboard -i >/dev/null 2>&1 -} - -vc_xclip_paste() { - xclip -selection clipboard -o -} - -vc_mac_copy() { - pbcopy -} - -vc_mac_paste() { - pbpaste -} - -vc_cygwin_copy() { - cat >/dev/clipboard -} - -vc_cygwin_paste() { - cat /dev/clipboard -} - -case "$1" in - --usable) vc_usable;; - --copy) vc_copy;; - --paste) vc_paste;; - *) ;; -esac - -vc_usage diff --git a/bin/armv7l/vis-menu b/bin/armv7l/vis-menu Binary files differ. diff --git a/bin/armv7l/vis-open b/bin/armv7l/vis-open @@ -1,64 +0,0 @@ -#!/bin/sh -set -e - -# Later, we're going to want to set $IFS to a single newline, so let's prepare one. -NL=' -' - -VIS_MENU_PROMPT="" -ALLOW_AUTO_SELECT=1 - -while [ $# -gt 0 ]; do - case "$1" in - -h|--help) - echo "usage: $(basename $0) [-h] [-p prompt] [-f] [--] [file-pattern]" - exit 0; - ;; - -p) - VIS_MENU_PROMPT=$2 - shift - shift - ;; - -f) - ALLOW_AUTO_SELECT="" - shift - ;; - --) - shift - break - ;; - *) - break - ;; - esac -done - -# At this point, all the remaining arguments should be the expansion of -# any globs that were passed on the command line. - -if [ $# -eq 1 -a "$ALLOW_AUTO_SELECT" = 1 ]; then - # If there were globs on the command-line, they've expanded to - # a single item, so we can just process it. - - if [ -d "$1" ]; then - # Recurse and show the contents of the named directory, - # We pass -f to force the next iteration to present the - # full list, even if it's just an empty directory. - cd "$1" - IFS=$NL # Don't split ls output on tabs or spaces. - exec "$0" -p "$VIS_MENU_PROMPT" -f .. $(ls -1) - else - # We've found a single item, and it's not a directory, - # so it must be a filename (or file-like thing) to open. - cd "$(dirname "$1")" - echo "$(pwd -P)"/"$(basename "$1")" - exit 0 - fi -fi - -# At this point, we have a bunch of options we need to present to the -# user so they can pick one. -CHOICE=$(printf "%s\n" "$@" | vis-menu -b -p "$VIS_MENU_PROMPT") - -# Did they pick a file or directory? Who knows, let's let the next iteration figure it out. -exec "$0" -p "$VIS_MENU_PROMPT" -- "$CHOICE" diff --git a/bin/attach b/bin/attach @@ -1,36 +0,0 @@ -#!/bin/sh -# /\ /\ /\ -# _____ / /_ / /_ _____ ____ / /_ -# .'__ // ___\/ ___\.'__ // ___\ / __ \ -# / /_/ // / / / / /_/ // /__ / / / / -# \____/ \/ \/ \____/ \____\ \/ \/ - Attach to an abduco session -#=============================================================================== - -# External: abduco, vis-menu -# Busybox: sed - -TAB=' ' # Make literal tabs explicit on the code - -# If already on a session, print its name and exit -[ "$ABDUCO" ] && printf '[ %s ]\n' "$ABDUCO" | tr '!' '/' && exit 1 - -printf '\033[1A' - -# Get the session name by prompting the user. Workaround for tab error -# of vis-menu (https://github.com/martanne/vis/issues/365) -name="$(abduco \ - | sort -t "$TAB" -k 3 \ - | tr '!' '/' \ - | sed '1d; s/\t/ /g' \ - | vis-menu -l 10 \ - | tr '/' '!' -)" -name="${name##* }" - -# Reset the screen, set the name of the session and attath to it -printf '\033[2J\033[0;0f\033[0m\033]0;%s\007' "$name" | tr '!' '/' -[ "$name" ] && TERM=screen ABDUCO="$name" abduco -e '^z' -a "$name" - -# Reminder of current sessions -printf '\n' -abduco | tr '!' '/' | sort -t "$TAB" -k 3 | sed -n '1d; s/^/ /; s/\t/ /g p' diff --git a/bin/feeds b/bin/feeds @@ -1,191 +0,0 @@ -#!/bin/sh -# ____ /\ -# .' ___\ ___ ___ ___/ / ____ -# / .'_ .'__ \ .'__ \ .'__ / / __/ -# / ___/ / ____// ____// /_/ /__\ \ -# \/ \___\ \___\ \____/ \___/ - Simple RSS/ATOM feed reader -#=============================================================================== - -FEEDS="${FEEDS-$DOT/doc/feeds}" -BROWSER="${BROWSER-firefox}" -CACHE="${CACHE-$HOME/.cache/feeds}" - -help=" -NAME - feeds - Simple RSS/ATOM fead reader - -SYNTAX - feeds COMMAND - -DESCRIPTION - view Choose a feed to read in $BROWSER - get Get/Update the feeds and the read/unread marks. - -ENVIRONMENT - FEEDS Path to the directory of feeds (./urls) and read (./read) list. - BROWSER Command to open the url of the feeds. - CACHE Path to the cache directory. - FILTER Command to filter the input and display only one output. - -FILES - $FEEDS/urls - List of RSS/ATOM urls, one link per line. - - $FEEDS/read - List of links already opened. - - $CACHE/* - Content of the RSS/ATOM files parsed by the rss.awk or atom.awk. - -" - - -#===[ SCRIPTS ]================================================================ - -awk_format_columns=' -BEGIN{ - max1=0; - max2=0; -} - -{ - l++; - - c1[l] = $1; # First column - - for (i=2; i < NF; i++) { # Middle column - c2[l] = c2[l]$(i)(i<NF?OFS:""); - } - - c3[l] = $NF; # Last column - - max1 = ((length(c1[l]) > max1) ? length(c1[l]) : max1); - max2 = ((length(c2[l]) > max2) ? length(c2[l]) : max2); -} - -END { - for (i = 1; i <= l; i++) { - printf("%-"max1"s %-"max2"s %s\n", c1[i], c2[i], c3[i]); - } -}' - -#===[ FUNCTIONS ]=============================================================== - -# -# Check if feeds have been seen, and add a 'N' to the beginning of the line if -# so, and a '-' if not. Read stdin and print stdout. -# -check_read() -{ - while read line - do - read=0 - url="$(printf '%s' "$line" | awk '{ print $NF }')" - - if [ -z "$(grep -F "$url" "$FEEDS/read")" ] - then - printf '%s\n' "N $line" - else - printf '%s\n' "- $line" - fi - done -} - -# -# Check if the feed is RSS or ATOM, and transforms it in a list. -# -parse() -{ - local content="$1" - - if [ ! -z "$(printf '%s' "$content" | sed -n '/<rss[^>]*>/ p' )" ] - then RS='<[/]?item[^>]*>' ; begin='.*<link[^>]>'; end='<\/link>.*' - else RS='<[/]?entry[^>]*>'; begin='.*href=\42' ; end='\42.*' - fi - - printf '%s' "$content" | awk -v RS="$RS" ' -BEGIN { - max1=0; - max2=0; -} - -NR > 1 && NR < $(NR-1) { - title = $0 - sub(/.*<title[^>]*>/, "", title) - sub(/<\/title>.*/, "", title) - - url = $0 - sub(/'"$begin"'/, "", url) - sub(/'"$end"'/, "", url) - - printf("%s %s\n", title, url) -}' -} - -# -# Download each URL from $FEEDS/urls, parse them, check for read/unread, and -# store the generated list in $FEEDS/feeds/$title. -# -get() -{ - sed -r '/^(#.*)?$/ d' "$FEEDS/urls" | while read feed - do - content="$(wget -qO - $feed)" - title="$(printf '%s' "$content" \ - | sed 's/<\/title>.*//' \ - | sed -n 's/.*<title[^>]*>// p' \ - | sed 1q \ - | tr ' [A-Z]' '_[a-z]' \ - | tr -cd '[a-z][1-9_.,-]')" - printf '%s\n' "$title" - - parse "$content" | check_read | awk "$awk_format_columns" \ - > "$CACHE/$title" - done -} - -# -# List and pompt the feed for displaying articles. -# -view() -{ - tempfile="$(mktemp)" - - for feed in $(ls "$CACHE") - do - # count number of unread items - printf '%4s %s\n' \ - "$(sed -n '/^N / p' "$CACHE/$feed" | wc -l)" \ - "$feed" >> "$tempfile" - - # update the read/unread marks - printf '%s' "$(cat "$CACHE/$feed" \ - | cut -c 3- \ - | check_read)" > "$CACHE/$feed" - done - - sort -ro "$tempfile" "$tempfile" - - selection="$( \ - cat "$CACHE/$(cat "$tempfile" | $FILTER | sed 's/ *[0-9]* //')" \ - | $FILTER \ - | awk '{ print $NF }')" - - rm "$tempfile" - - printf '%s\n' "$selection" >> "$FEEDS/read" - - $BROWSER "$selection" -} - -#===[ ALGORYTHM ]=============================================================== - -[ ! -d "$CACHE" ] && mkdir -p "$CACHE" -touch "$FEEDS/read" -touch "$FEEDS/urls" - -case $1 in - g | get ) get;; - v | view ) view;; - * ) printf '%s\n' "$help" -esac diff --git a/bin/run b/bin/run @@ -1,63 +0,0 @@ -#/bin/sh -# _____ __ /\ ____ -# / ____\/ / / // __ \ -# / / / /_/ // / / / -# \/ \____/ \/ \/ - Pick a command to run in a dedicated abduco session -#=============================================================================== - -# External: stest, vis-menu, abduco -# Busybox: mkdir, tee, sort, clear - -NL=' -' # Trick to use newline character without breaking identation -cmd="$1" - -# Get or create the cache file -cache="${XDG_CACHE_HOME:-"$HOME/.cache"}" -mkdir -p "$cache" -cache="$cache/dmenu_run" - -# Update the cathe and get the command -printf '\033[1A' -[ -z "$cmd" ] && cmd="$( - IFS=: - if stest -dqr -n "$cache" $PATH - then stest -flx $PATH | sort -u | tee "$cache" - else tee < "$cache" - fi | vis-menu -)" -printf '$ %s ' "$cmd" - -# Get command arguments and the session name -name="$cmd" -case "$cmd" in -'' ) exit 1 ;; -mbsync ) opt='-a' ;; -alsamixer ) opt='-c 1' ;; -ping ) opt='-c 3 www.wikipedia.org' ;; -feeds ) opt='read' ;; -htop | s-nail | irc | rirc | agenda | cmus ) : ;; -vi | vim | vis | less ) - opt="$(find ./ -type f ! -path '*/.git/*' | vis-menu -l 10)" file="$opt" - ;; -* ) - read opt - if [ -z "${opt##*\**}" -a "$opt" ] - then - file="$(find ./ -type f | vis-menu -l 10)" - opt="${opt##*\*} $file ${opt%%\**}" - fi - ;; -esac - -# Update the name using the file path -if [ "$file" ] -then - file="$PWD/${file#./}" - [ -z "${file##$HOME*}" ] && file="~${file#$HOME}" - file=" $file" -fi - -# Start the command in an abduco session -TERM=screen ABDUCO="$cmd" \ - abduco -e '^z' -A "$(printf '%s%s' "$cmd" "$file" | tr '/' '!')" $cmd $opt diff --git a/cgo/build.sh b/cgo/build.sh @@ -1,3 +0,0 @@ -# C Gopher Client - -tar=http://github.com/kieselsteini/cgo/archive/master.tar.gz diff --git a/doc/feeds/read b/doc/feeds/read @@ -1,32 +0,0 @@ - - -http://omicsomics.blogspot.com/2016/02/agbt-begins-with-bonus-storify-jeremiad.html - - - - - - - -http://omicsomics.blogspot.com/2016/04/genia-publishes-platform-progress.html - -http://omicsomics.blogspot.com/2016/04/protein-homeostasis-has-it-hit.html - - -http://omicsomics.blogspot.com/2016/05/around-world-in-amino-acids.html -http://omicsomics.blogspot.com/2016/06/london-calling-was-two-weeks-ago-and-i.html - -http://omicsomics.blogspot.com/2016/05/london-calling-notes-on-brownian.html -http://omicsomics.blogspot.com/2016/05/london-calling-preview.html -http://omicsomics.blogspot.com/2016/05/inconstant-lines.html -http://omicsomics.blogspot.com/2016/05/sickle-cell-anemia-underprioritized.html -http://omicsomics.blogspot.com/2016/05/kendall-square-techbiotechbiopharma.html -http://omicsomics.blogspot.com/2016/05/exploring-critiques-of-siddhartha.html -http://omicsomics.blogspot.com/2016/04/mosquito-genomes-chance-for-long-range.html -http://omicsomics.blogspot.com/2016/03/reflections-on-and-band-played-on.html -http://omicsomics.blogspot.com/2016/02/10x-launches-chromium-agbt16.html -http://omicsomics.blogspot.com/2016/03/who-wants-to-write-review-article.html -http://omicsomics.blogspot.com/2016/06/writing-big.html - - - diff --git a/dvtm/config.h b/dvtm/config.h @@ -63,14 +63,11 @@ static Color colors[] = { #define SCROLL_HISTORY 2000 const char tags[][10] = { - "1 term", - "2 repl", - "3 edit", - "4 view", - "5 mail", - "6 chat", - "7 media", - "8 stat", + "1", + "2", + "3", + "4", + "5", }; #include "tile.c" @@ -124,6 +121,7 @@ static KeyBinding bindings[] = { { { MOD, 'c', }, { create, { NULL } } }, { { MOD, 'C', }, { create, { NULL, NULL, "$CWD" } } }, { { MOD, CTRL('c'), }, { create, { "run" } } }, + { { MOD, 'a', }, { create, { "attach" } } }, { { MOD, '?', }, { create, { "man dvtm", "dvtm help" } } }, { { MOD, 'x', 'x', }, { killclient, { NULL } } }, { { MOD, 'q', 'q', }, { quit, { NULL } } }, @@ -227,15 +225,6 @@ static Button buttons[] = { static Cmd commands[] = { { "create", { create, { NULL } } }, - { "tag1", { tag, { tags[0] } } }, - { "tag2", { tag, { tags[1] } } }, - { "tag3", { tag, { tags[2] } } }, - { "tag4", { tag, { tags[3] } } }, - { "tag5", { tag, { tags[4] } } }, - { "tag6", { tag, { tags[5] } } }, - { "tag7", { tag, { tags[6] } } }, - { "tag8", { tag, { tags[7] } } }, - { "tag9", { tag, { tags[8] } } }, }; /* gets executed when dvtm is started */ diff --git a/fzy/build.sh b/fzy/build.sh @@ -0,0 +1,3 @@ +# Fuzzy finder that rocks + +tar=http://github.com/jhawthorn/fzy/archive/master.tar.gz diff --git a/icat/build.sh b/icat/build.sh @@ -1,9 +0,0 @@ -# Terminal image viewer - -tar=https://github.com/atextor/icat/archive/master.tar.gz - -build() -{ - make - cp icat $PREFIX/bin -} diff --git a/luarocks/build.sh b/luarocks/build.sh @@ -1,10 +0,0 @@ -# Lua package manager - -tar=http://luarocks.org/releases/luarocks-2.3.0.tar.gz - -build() -{ - ./configure --prefix="$PREFIX" - make build - make install -}- \ No newline at end of file diff --git a/pkg-config/build.sh b/pkg-config/build.sh @@ -1,3 +0,0 @@ -# Unified library path finder - -tar=http://pkgconfig.freedesktop.org/releases/pkg-config-0.29.1.tar.gz- \ No newline at end of file diff --git a/popcorntime/build.sh b/popcorntime/build.sh @@ -1,8 +0,0 @@ -# Torrent video streaming platform - -tar=https://popcorntime.sh/download/build/Popcorn-Time-0.3.9-Linux-64.tar.xz - -build() -{ - ln -sf $PWD/Popcorn-Time "$PREFIX/bin/popcorntime" -}- \ No newline at end of file diff --git a/rirc/build.sh b/rirc/build.sh @@ -1,11 +0,0 @@ -# Simple yet much usable irc client - -tar=https://github.com/rcr/rirc/archive/master.tar.gz - -build() -{ - cp -f "$CONFIG/$1/config.h" "$PROGRAMS/$1/src/src/config.h" - make - mkdir -p "$PREFIX/bin" - cp rirc $PREFIX/bin -} diff --git a/rirc/config.h b/rirc/config.h @@ -1,14 +0,0 @@ -/* Rirc configuration header */ - -/* Colors */ -#define NEUTRAL_FG 239 -#define MSG_DEFAULT_FG 7 -#define MSG_GREEN_FG 2 -static int nick_colours[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; - -/* Characters */ -#define QUOTE_CHAR '>' -#define HORIZONTAL_SEPARATOR "-" -#define VERTICAL_SEPARATOR "|" - -static int actv_cols[ACTIVITY_T_SIZE] = {239, 239, 3}; diff --git a/doc/agenda b/shell/.cache/agenda diff --git a/doc/.cache/bkm b/shell/.cache/bkm diff --git a/doc/todo b/shell/.cache/todo diff --git a/shell/.config/feeds/read b/shell/.config/feeds/read @@ -0,0 +1,33 @@ + + +http://omicsomics.blogspot.com/2016/02/agbt-begins-with-bonus-storify-jeremiad.html + + + + + + + +http://omicsomics.blogspot.com/2016/04/genia-publishes-platform-progress.html + +http://omicsomics.blogspot.com/2016/04/protein-homeostasis-has-it-hit.html + + +http://omicsomics.blogspot.com/2016/05/around-world-in-amino-acids.html +http://omicsomics.blogspot.com/2016/06/london-calling-was-two-weeks-ago-and-i.html + +http://omicsomics.blogspot.com/2016/05/london-calling-notes-on-brownian.html +http://omicsomics.blogspot.com/2016/05/london-calling-preview.html +http://omicsomics.blogspot.com/2016/05/inconstant-lines.html +http://omicsomics.blogspot.com/2016/05/sickle-cell-anemia-underprioritized.html +http://omicsomics.blogspot.com/2016/05/kendall-square-techbiotechbiopharma.html +http://omicsomics.blogspot.com/2016/05/exploring-critiques-of-siddhartha.html +http://omicsomics.blogspot.com/2016/04/mosquito-genomes-chance-for-long-range.html +http://omicsomics.blogspot.com/2016/03/reflections-on-and-band-played-on.html +http://omicsomics.blogspot.com/2016/02/10x-launches-chromium-agbt16.html +http://omicsomics.blogspot.com/2016/03/who-wants-to-write-review-article.html +http://omicsomics.blogspot.com/2016/06/writing-big.html + + + + diff --git a/doc/feeds/urls b/shell/.config/feeds/urls diff --git a/shell/.profile b/shell/.profile @@ -27,9 +27,10 @@ export TERMCAP="vt102|$TERM|dec vt102:"'\ # COMMANDS -for editor in vi vim ex-vi vis -do command -v "$editor" > /dev/null && export EDITOR="$editor" +for editor in vi vis ex-vi +do command -v "$editor" > /dev/null && EDITOR="$editor" done +export EDITOR export ALTERNATE_EDITOR='vi' export DVTM_EDITOR="$EDITOR" export VISUAL="$EDITOR" @@ -45,8 +46,7 @@ export DOT="$HOME/Config" export MAIL="$HOME/Mail/INBOX" export ENV="$HOME/.profile" export PATH="$PATH:$HOME/.local/bin" # binaries built locally -export PATH="$PATH:$DOT/bin" # scripts -export PATH="$PATH:$DOT/bin/$(uname -m)" # binaries carried on $DOT +export PATH="$PATH:$DOT/shell/bin" # scripts export XDG_CONFIG_HOME="$HOME/.config" export XDG_CACHE_HOME="$HOME/.cache" export XDG_DATA_HOME="$HOME/.local/share" @@ -101,21 +101,21 @@ ps1() printf '\r\033[%sC%s' "$((${size#* } - ${#date} - 1))" "$date" printf '\033[0m' - # Non printable: terminal status, bell and cursor position - printf '\a\033]0;%s\007\n' "$pwd" + # Non printable: terminal status, bell + #printf '\a\033]0;%s\007' "$pwd" # Last line fo prompt - printf "%s$ " "${abduco#0}" + printf "\n%s$ " "${abduco#0}" } d() { - find "${1-.}" -type d ! -path '*/.git/*' | vis-menu -l 10 + find "${1-.}" -type d ! -path '*/.git/*' | fzy } x() { - find "${1-.}" -type f ! -path '*/.git/*' | vis-menu -l 10 + find "${1-.}" -type f ! -path '*/.git/*' | fzy } c() @@ -250,3 +250,5 @@ fi # STARTUP #------------------------------------------------------------------------------- + +printf '\n' diff --git a/bin/beep-music b/shell/bin/adagio diff --git a/bin/agenda b/shell/bin/agenda diff --git a/shell/bin/attach b/shell/bin/attach @@ -0,0 +1,30 @@ +#!/bin/sh +# /\ /\ /\ +# _____ / /_ / /_ _____ ____ / /_ +# .'__ // ___\/ ___\.'__ // ___\ / __ \ +# / /_/ // / / / / /_/ // /__ / / / / +# \____/ \/ \/ \____/ \____\ \/ \/ - Attach to an abduco session +#=============================================================================== + +# External: abduco, fzy +# Busybox: tr, sort, sed + +TAB=' ' # Make literal tabs explicit on the code + +# If already on a session, print its name and exit +[ "$ABDUCO" ] && printf '[ %s ]\n' "$ABDUCO" | tr '!' '/' && exit 1 + +printf '\033[1A' + +# get the session name by prompting the user +name="$(abduco | sed 1d | sort -t "$TAB" -k 3 | tr '!' '/' | fzy | tr '/' '!')" +name="${name##*$TAB}" +printf '%s\n' "$name" + +# Reset the screen, set the name of the session and attath to it +printf '\033[2J\033[0;0f\033[0m\033]0;%s\007' "$name" | tr '!' '/' +[ "$name" ] && TERM=screen ABDUCO="$name" abduco -e '^z' -a "$name" + +# Reminder of current sessions +printf '\n' +abduco | tr '!' '/' | sort -t "$TAB" -k 3 | sed '1d; s/^/ /' diff --git a/bin/bkm b/shell/bin/bkm diff --git a/bin/blawk b/shell/bin/blawk diff --git a/bin/comment b/shell/bin/comment diff --git a/bin/dna b/shell/bin/dna diff --git a/bin/drawk b/shell/bin/drawk diff --git a/shell/bin/feeds b/shell/bin/feeds @@ -0,0 +1,193 @@ +#!/bin/sh +# ____ /\ +# .' ___\ ___ ___ ___/ / ____ +# / .'_ .'__ \ .'__ \ .'__ / / __/ +# / ___/ / ____// ____// /_/ /__\ \ +# \/ \___\ \___\ \____/ \___/ - Simple RSS/ATOM feed reader +#=============================================================================== + +FEEDS="${FEEDS-$HOME/.config/feeds}" +BROWSER="${BROWSER-firefox}" +CACHE="${CACHE-$HOME/.cache/feeds}" + +help=" +NAME + feeds - Simple RSS/ATOM fead reader + +SYNTAX + feeds COMMAND + +DESCRIPTION + view Choose a feed to read in $BROWSER + get Get/Update the feeds and the read/unread marks. + +ENVIRONMENT + FEEDS Path to the directory of feeds (./urls) and read (./read) list. + BROWSER Command to open the url of the feeds. + CACHE Path to the cache directory. + +FILES + $FEEDS/urls + List of RSS/ATOM urls, one link per line. + + $FEEDS/read + List of links already opened. + + $CACHE/* + Content of the RSS/ATOM files parsed by the rss.awk or atom.awk. + +" + + +# SCRIPTS +#-------------------------------------------------------------------------------- + +awk_format_columns=' +BEGIN{ + max1=0; + max2=0; +} + +{ + l++; + + c1[l] = $1; # First column + + for (i=2; i < NF; i++) { # Middle column + c2[l] = c2[l]$(i)(i<NF?OFS:""); + } + + c3[l] = $NF; # Last column + + max1 = ((length(c1[l]) > max1) ? length(c1[l]) : max1); + max2 = ((length(c2[l]) > max2) ? length(c2[l]) : max2); +} + +END { + for (i = 1; i <= l; i++) { + printf("%-"max1"s %-"max2"s %s\n", c1[i], c2[i], c3[i]); + } +}' + +# FUNCTIONS +#-------------------------------------------------------------------------------- + +# +# Check if feeds have been seen, and add a 'N' to the beginning of the line if +# so, and a '-' if not. Read stdin and print stdout. +# +check_read() +{ + while read line + do + read=0 + url="$(printf '%s' "$line" | awk '{ print $NF }')" + + if [ -z "$(grep -F "$url" "$FEEDS/read")" ] + then + printf '%s\n' "N $line" + else + printf '%s\n' "- $line" + fi + done +} + +# +# Check if the feed is RSS or ATOM, and transforms it in a list. +# +parse() +{ + local content="$1" + + if [ ! -z "$(printf '%s' "$content" | sed -n '/<rss[^>]*>/ p' )" ] + then RS='<[/]?item[^>]*>' ; begin='.*<link[^>]>'; end='<\/link>.*' + else RS='<[/]?entry[^>]*>'; begin='.*href=\42' ; end='\42.*' + fi + + printf '%s' "$content" | awk -v RS="$RS" ' +BEGIN { + max1=0; + max2=0; +} + +NR > 1 && NR < $(NR-1) { + title = $0 + sub(/.*<title[^>]*>/, "", title) + sub(/<\/title>.*/, "", title) + + url = $0 + sub(/'"$begin"'/, "", url) + sub(/'"$end"'/, "", url) + + printf("%s %s\n", title, url) +}' +} + +# +# Download each URL from $FEEDS/urls, parse them, check for read/unread, and +# store the generated list in $FEEDS/feeds/$title. +# +get() +{ + sed -r '/^(#.*)?$/ d' "$FEEDS/urls" | while read feed + do + content="$(wget -qO - $feed)" + title="$(printf '%s' "$content" \ + | sed 's/<\/title>.*//' \ + | sed -n 's/.*<title[^>]*>// p' \ + | sed 1q \ + | tr ' [A-Z]' '_[a-z]' \ + | tr -cd '[a-z][1-9_.,-]')" + printf '%s\n' "$title" + + parse "$content" | check_read | awk "$awk_format_columns" \ + > "$CACHE/$title" + done +} + +# +# List and pompt the feed for displaying articles. +# +view() +{ + tempfile="$(mktemp)" + + for feed in $(ls "$CACHE") + do + # count number of unread items + printf '%4s %s\n' \ + "$(sed -n '/^N / p' "$CACHE/$feed" | wc -l)" \ + "$feed" >> "$tempfile" + + # update the read/unread marks + printf '%s' "$(cat "$CACHE/$feed" \ + | cut -c 3- \ + | check_read)" > "$CACHE/$feed" + done + + sort -ro "$tempfile" "$tempfile" + + selection="$(cat "$CACHE/$(cat "$tempfile" \ + | fzy \ + | sed 's/ *[0-9]* //')" \ + | fzy \ + | awk '{ print $NF }')" + + rm "$tempfile" + + printf '%s\n' "$selection" >> "$FEEDS/read" + + $BROWSER "$selection" +} + +#===[ ALGORYTHM ]=============================================================== + +[ ! -d "$CACHE" ] && mkdir -p "$CACHE" +touch "$FEEDS/read" +touch "$FEEDS/urls" + +case $1 in + g | get ) get;; + v | view ) view;; + * ) printf '%s\n' "$help" +esac diff --git a/bin/fig b/shell/bin/fig diff --git a/bin/headline b/shell/bin/headline diff --git a/bin/irc b/shell/bin/irc diff --git a/bin/lsync b/shell/bin/lsync diff --git a/bin/peax b/shell/bin/peax diff --git a/bin/piano b/shell/bin/piano diff --git a/shell/bin/run b/shell/bin/run @@ -0,0 +1,63 @@ +#/bin/sh +# _____ __ /\ ____ +# / ____\/ / / // __ \ +# / / / /_/ // / / / +# \/ \____/ \/ \/ - Pick a command to run in a dedicated abduco session +#=============================================================================== + +# External: stest, fzy, abduco +# Busybox: mkdir, tee, sort, clear + +NL=' +' # Trick to use newline character without breaking identation +cmd="$1" + +# Get or create the cache file +cache="${XDG_CACHE_HOME:-"$HOME/.cache"}" +mkdir -p "$cache" +cache="$cache/dmenu_run" + +# Update the cathe and get the command +printf '\033[1A' +[ -z "$cmd" ] && cmd="$( + IFS=: + if stest -dqr -n "$cache" $PATH + then stest -flx $PATH | sort -u | tee "$cache" + else tee < "$cache" + fi | fzy +)" +printf '$ %s ' "$cmd" + +# Get command arguments and the session name +name="$cmd" +case "$cmd" in +'' ) exit 1 ;; +mbsync ) opt='-a' ;; +alsamixer ) opt='-c 1' ;; +ping ) opt='-c 3 www.wikipedia.org' ;; +feeds ) opt='read' ;; +htop | s-nail | irc | rirc | agenda | cmus ) : ;; +vi | vim | vis | less | ex-vi | ex | ed | emacsclient ) + opt="$(find ./ -type f ! -path '*/.git/*' | fzy)" file="$opt" + ;; +* ) + read opt + if [ -z "${opt##*\**}" -a "$opt" ] + then + file="$(find ./ -type f | fzy)" + opt="${opt##*\*} $file ${opt%%\**}" + fi + ;; +esac + +# Update the name using the file path +if [ "$file" ] +then + file="$PWD/${file#./}" + [ -z "${file##$HOME*}" ] && file="~${file#$HOME}" + file=" $file" +fi + +# Start the command in an abduco session +TERM=screen ABDUCO="$cmd" \ + abduco -e '^z' -A "$(printf '%s%s' "$cmd" "$file" | tr '/' '!')" $cmd $opt diff --git a/bin/src b/shell/bin/src diff --git a/bin/todo b/shell/bin/todo diff --git a/bin/www b/shell/bin/www diff --git a/smu/build.sh b/smu/build.sh @@ -1,3 +0,0 @@ -# Dynamic menu - -tar=http://github.com/Gottox/smu/archive/master.tar.gz diff --git a/vim/.vimrc b/vim/.vimrc @@ -1,134 +0,0 @@ -" __ -" __ /\ \/ ________ _____ ____ -" / / / / /\ / __ __ \ / ____\/ ___\ -" \ \/ / / // / / / / // / / /__ -" \_.' \/ \/ \/ \/ \/ \____\ - without plugins if possible -"=============================================================================== - - -" SETTINGS -"------------------------------------------------------------------------------- - -set nocompatible - -" Appearance -set list listchars=tab:\:\ ,space:.,trail:.,extends:>,precedes:<,nbsp:_,eol:$ -set fillchars=vert:\|,fold:- - -" Interface -set wildmenu wildmode=longest:full,full " Wild -set showcmd showmode laststatus=2 ruler " Verbose interface -set colorcolumn=80 cursorline scrolloff=5 " Lines & columns indicators -set visualbell - -" Code -filetype indent plugin on -syntax on -set omnifunc=syntaxcomplete#Complete " Completion -set smarttab shiftwidth=8 tabstop=8 " Tabs -set autoindent smartindent " Indentation -set textwidth=0 formatprg=fmt " Formatting - -" Search -set ignorecase smartcase " Case -set showmatch incsearch " Highlights -set nolazyredraw - -" Backups and undos -set undodir=~/.vim/tmp undofile -set backupdir=~/.vim/tmp,. -set directory=~/.vim/tmp,. - - -" PLUGINS -"------------------------------------------------------------------------------- - -execute pathogen#infect() - - -" KEYS -"------------------------------------------------------------------------------- - -let mapleader = ' ' -inoremap jk <esc> - -" Occur -nnoremap g/ :vimgrep /<C-R>//j %<CR>\|:cw<CR> - -" Insert spaces -nnoremap [<space> O<esc>j<c-e> -nnoremap ]<space> o<esc>k - -" Exchange lines -nnoremap [e ddkP -nnoremap ]e ddp - - -" OPTIONS - -nnoremap cov :if &ve == '' \| se ve=all \| else \| se ve= \| endif<cr>:se ve<cr> -nnoremap co- :set cursorline! \| set cursorline? <cr> -nnoremap co<bar> :set cursorcolumn! \| set cursorcolumn? <cr> -nnoremap coh :set hlsearch! \| set hlsearch? <cr> -nnoremap coi :set ignorecase! \| set ignorecase? <cr> -nnoremap col :set list! \| set list? <cr> -nnoremap con :set number! \| set number? <cr> -nnoremap cop :set paste! \| set paste? <cr> -nnoremap cor :set relativenumber! \| set relativenumber?<cr> -nnoremap cos :set spell! \| set spell? <cr> -nnoremap cow :set wrap! \| set wrap? <cr> - - -" MENU - -nnoremap <leader> : -nnoremap <leader><leader> :pwd \| tabs \| echo '' \| buffers \| echo ''<cr>: -nnoremap <leader>b :pwd \| echo ' ' \| buffers \| echo ' '<cr>:b -nnoremap <leader>t :pwd \| tabs \| echo ' '<cr>:tab -nnoremap <leader>T :pwd \| echo ' ' \| tags \| echo ' '<cr>:tag -nnoremap <leader>' :pwd \| echo ' ' \| marks \| echo ' '<cr> -nnoremap <leader>" : echo ' ' \| registers \| echo ' '<cr> -nnoremap <leader>u : echo ' ' \| undolist \| echo ' '<cr>:undo -nnoremap <leader>U :UndotreeToggle \| UndotreeFocus <cr> -nnoremap <leader>e :pwd \| echo ' ' \| buffers \| echo ' '<cr>:e -nnoremap <leader>f :pwd \| echo ' ' <cr>:find -nnoremap <leader>c :pwd \| echo ' ' \| clist \| echo ' '<cr>:c -nnoremap <leader>w :w <cr> - - -" MACROS - -" Comment column (50) and equal column (30) -nnoremap <leader><tab> mzD:set ve=all<cr>050lhP:set ve=<cr>`z -nnoremap <leader><cr> mzD:set ve=all<cr>030lhP:set ve=<cr>`z - -" Square a block with ascii/unicode border -vnoremap <leader>s mzomwOmxomy<esc>`xj<c-v>`zkr<bar>`wj<c-v>`ykr<bar>`xr.h<c-v>`wr-r.`zr'h<c-v>`yr-r' - -" Execute normal command over visual selection -nnoremap <leader>r :'<,'>g/^/norm - -" Playback the current macro, go to the first letter of the next line -nnoremap <leader>j @qj^ -nnoremap <leader>J @qk^ - -" Extract to another file -vnoremap <leader>x "md:enew<cr>"mp - - -" ABBREVIATIONS -"------------------------------------------------------------------------------- - -" Rulers -iab __ <space><esc>:set ve=all<cr>v080lhr_:set ve=<cr>A -iab -_ <space><esc>:set ve=all<cr>v080lhr-:set ve=<cr>A -iab =_ <space><esc>:set ve=all<cr>v080lhr=:set ve=<cr>A - - -" AUTOCOMMANDS -"------------------------------------------------------------------------------- - -augroup templates - autocmd! - autocmd BufNewFile *.* silent! exe '0r' . g:vimdir . '/templates/' . &ft -augroup END diff --git a/vis/build.sh b/vis/build.sh @@ -1,11 +1,3 @@ # Simple yet powerful text editor tar=https://github.com/martanne/vis/archive/master.tar.gz - -build() -{ - ./configure --prefix="$PREFIX" - make vis-menu - cp ./vis-menu "$PREFIX/bin/vis-menu" - make install -}- \ No newline at end of file