From 1750a4cc5e03521fb85932a14d1cf271d27ec1ea Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Thu, 16 Aug 2018 18:00:42 -0400 Subject: Port all scripts to sh Not hard, but having to escape ( ) inside [ ] had me confused for a bit. --- link.sh | 18 ++++++++++++++++++ link.zsh | 18 ------------------ pdf.sh | 28 ++++++++++++++++++++++++++++ pdf.zsh | 28 ---------------------------- prune.sh | 7 +++++++ prune.zsh | 7 ------- 6 files changed, 53 insertions(+), 53 deletions(-) create mode 100755 link.sh delete mode 100755 link.zsh create mode 100755 pdf.sh delete mode 100755 pdf.zsh create mode 100755 prune.sh delete mode 100755 prune.zsh diff --git a/link.sh b/link.sh new file mode 100755 index 00000000..0f1f49aa --- /dev/null +++ b/link.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -e -u + +if [ $# -eq 1 ]; then + linkPath=$1 + filePath="$PWD/home/${linkPath#$HOME/}" + [ ! -f "$filePath" ] + mkdir -p "$(dirname "$filePath")" + mv "$linkPath" "$filePath" +fi + +find home -type f | while read -r findPath; do + filePath="$PWD/$findPath" + linkPath="$HOME/${findPath#home/}" + mkdir -p "$(dirname "$linkPath")" + [ \( -f "$linkPath" -a -L "$linkPath" \) -o ! -f "$linkPath" ] + ln -s -f "$filePath" "$linkPath" +done diff --git a/link.zsh b/link.zsh deleted file mode 100755 index a0a9e7aa..00000000 --- a/link.zsh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail - -if [[ $# -eq 1 ]]; then - linkPath="$1" - filePath="$PWD/home/${linkPath#$HOME/}" - [[ ! -f "$filePath" ]] - mkdir -p "$(dirname "$filePath")" - mv "$linkPath" "$filePath" -fi - -find home -type f | while read -r findPath; do - filePath="$PWD/$findPath" - linkPath="$HOME/${findPath#home/}" - mkdir -p "$(dirname "$linkPath")" - [[ ( -f "$linkPath" && -L "$linkPath" ) || ! -f "$linkPath" ]] - ln -s -f "$filePath" "$linkPath" -done diff --git a/pdf.sh b/pdf.sh new file mode 100755 index 00000000..90c73de1 --- /dev/null +++ b/pdf.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -e -u + +mkdir -p pdf + +fetch() { + [ -f "pdf/$1" ] && return + curl --silent --show-error --output "pdf/$1" "$2" + echo "pdf/$1" +} + +elf() { + fetch "$1" "http://refspecs.linuxbase.org/elf/$2" +} +intel() { + fetch "$1" "https://software.intel.com/sites/default/files/managed/$2" +} + +elf abi.pdf x86_64-abi-0.99.pdf +elf elf.pdf elf.pdf +fetch multiboot.pdf 'https://www.gnu.org/software/grub/manual/multiboot/multiboot.pdf' +intel intel-64-opt.pdf 9e/bc/64-ia-32-architectures-optimization-manual.pdf +intel intel-64-sdm-vol-1.pdf a4/60/253665-sdm-vol-1.pdf +intel intel-64-sdm-vol-2.pdf a4/60/325383-sdm-vol-2abcd.pdf +intel intel-64-sdm-vol-3.pdf a4/60/325384-sdm-vol-3abcd.pdf +intel intel-64-sdm-vol-4.pdf 22/0d/335592-sdm-vol-4.pdf + +chmod 444 pdf/*.pdf diff --git a/pdf.zsh b/pdf.zsh deleted file mode 100755 index 25458dfa..00000000 --- a/pdf.zsh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail - -mkdir -p pdf - -fetch() { - [[ -f "pdf/$1" ]] && return - curl --silent --show-error --output "pdf/$1" "$2" - echo "pdf/$1" -} - -elf() { - fetch "$1" "http://refspecs.linuxbase.org/elf/$2" -} -intel() { - fetch "$1" "https://software.intel.com/sites/default/files/managed/$2" -} - -elf abi.pdf x86_64-abi-0.99.pdf -elf elf.pdf elf.pdf -fetch multiboot.pdf 'https://www.gnu.org/software/grub/manual/multiboot/multiboot.pdf' -intel intel-64-opt.pdf 9e/bc/64-ia-32-architectures-optimization-manual.pdf -intel intel-64-sdm-vol-1.pdf a4/60/253665-sdm-vol-1.pdf -intel intel-64-sdm-vol-2.pdf a4/60/325383-sdm-vol-2abcd.pdf -intel intel-64-sdm-vol-3.pdf a4/60/325384-sdm-vol-3abcd.pdf -intel intel-64-sdm-vol-4.pdf 22/0d/335592-sdm-vol-4.pdf - -chmod 444 pdf/*.pdf diff --git a/prune.sh b/prune.sh new file mode 100755 index 00000000..31ab30cf --- /dev/null +++ b/prune.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e -u + +find -L ~ -type l -lname "$PWD/*" | while read -r linkPath; do + rm "$linkPath" + echo "$linkPath" +done diff --git a/prune.zsh b/prune.zsh deleted file mode 100755 index db85a9d1..00000000 --- a/prune.zsh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env zsh -set -o errexit -o nounset -o pipefail - -find -L ~ -type l -lname "$PWD/*" | while read -r linkPath; do - rm "$linkPath" - echo "$linkPath" -done -- cgit 1.4.1 c&follow=1'>Add Dirk Gently's Holistic Detective AgencyJune McEnroe 2019-02-20Move /opt/pkg after /usr in PATHJune McEnroe Installing mandoc from pkgsrc also installs a man executable which is horribly broken. Keep using the system man. 2019-02-20Set man_hard_wrap in nvimJune McEnroe Vendoring man.vim until <https://github.com/neovim/neovim/pull/9633> is merged and appears in a release. 2019-02-18Use hi -o anchor in upJune McEnroe 2019-02-18Don't match nested parentheses in Tag for CJune McEnroe Fixes mistaken highlight of: pngWrite(file, (uint8_t []) { 0, 0, 0 }, 3); 2019-02-18Match whitespace between * [] {}June McEnroe 2019-02-18Fix function-like #define regexJune McEnroe A define like #define FOO (1) is not function-like. 2019-02-18Match Tag in RustJune McEnroe 2019-02-18Match sh functions as TagJune McEnroe 2019-02-18Match Sh and Ss as Tag in mdocJune McEnroe 2019-02-18Match statics and typedefs as TagJune McEnroe 2019-02-18Clean up htmlHeaderJune McEnroe 2019-02-18Remove hi line numberingJune McEnroe Tags are much better for referring to specific parts of a file and line numbering is better done by a post-processing tool such as cat -n or producing a two-column HTML <table>. 2019-02-18Add Tag class to hiJune McEnroe 2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe Running hi twice to insert stuff between the head and the content is a bit of a hack but oh well. 2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe 2019-02-17Simplify temp trap in upJune McEnroe 2019-02-17Add line numbers to hiJune McEnroe Renames previous -n option to -m to stay consistent with cat -n. Prefixing lines with line numbers affects where the first tab indent ends up relative to the text above it. Not sure if it's worth fixing somehow. 2019-02-17Always split spans after newlinesJune McEnroe Simplifies ANSI and IRC output code, and prepares for line numbered output. 2019-02-15Color format specifiers light cyan in vimJune McEnroe 2019-02-15Highlight Interp as yellowJune McEnroe 2019-02-15Highlight strings in sh command substitutionsJune McEnroe 2019-02-15Add nmap gpJune McEnroe 2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe 2019-02-13Add forgotten "sixth" book of H2G2June McEnroe