1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 21:49:02 -08:00

NixOS compatibility

* use /usr/bin/env for all hashbangs
* enable hashall for bash
* workaround syntax error in -shrc for bash
This commit is contained in:
Connor Olding 2020-12-29 17:38:07 +01:00
parent 0be55777ee
commit d35c492850
20 changed files with 22 additions and 20 deletions

View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
# for zsh, bash, and ash. # for zsh, bash, and ash.
[ -n "$ZSH_VERSION" -o -n "$BASH" ] && FANCY=1 || FANCY=0 [ -n "$ZSH_VERSION" -o -n "$BASH" ] && FANCY=1 || FANCY=0
@ -131,7 +131,8 @@ alias pippy="maybesudo py -m pip install --upgrade --upgrade-strategy only-if-ne
alias crawla='ssh joshua@crawl.akrasiac.org -i ~/.ssh/crawl' alias crawla='ssh joshua@crawl.akrasiac.org -i ~/.ssh/crawl'
alias crawlz='ssh crawl@crawl.develz.org -i ~/.ssh/crawl' alias crawlz='ssh crawl@crawl.develz.org -i ~/.ssh/crawl'
ll() { alias ll="lol" # workaround for a strange issue with bash
lol() {
{ lr -1lshGG -o tev -t 'name~~".*"||type==d' "$@" \ { lr -1lshGG -o tev -t 'name~~".*"||type==d' "$@" \
&& lr -1lshGG -o tev -t 'name!~~".*"&&type!=d' "$@" \ && lr -1lshGG -o tev -t 'name!~~".*"&&type!=d' "$@" \
|| ls -lAX --group-directories-first --color=force "$@"; } | less || ls -lAX --group-directories-first --color=force "$@"; } | less

View file

@ -11,6 +11,7 @@ HISTFILESIZE=2000
shopt -s histappend shopt -s histappend
shopt -s checkwinsize shopt -s checkwinsize
#shopt -s physical # chaselinks (doesn't exist?) #shopt -s physical # chaselinks (doesn't exist?)
set -o hashall # enable hash command
if [[ "$TERM" = xterm* ]]; then if [[ "$TERM" = xterm* ]]; then
_title="\[\033]2;\w\a\]" _title="\[\033]2;\w\a\]"

View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
# awful things # awful things
MPV_STREAM_FLAGS="--quiet --autofit=1280x720 --loop-playlist=no --no-resume-playback --no-sub \ MPV_STREAM_FLAGS="--quiet --autofit=1280x720 --loop-playlist=no --no-resume-playback --no-sub \

View file

@ -1,2 +1,2 @@
#!/bin/zsh #!/usr/bin/env zsh
<<<"$(($@))" <<<"$(($@))"

2
sh/aur
View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# http://aur.sh with massive feature creep # http://aur.sh with massive feature creep
aur() { aur() {
trap 'exit 1' SIGINT SIGTERM trap 'exit 1' SIGINT SIGTERM

View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
dbusiest | read -r c d dbusiest | read -r c d
[ -z $c ] && return 1 [ -z $c ] && return 1
<<<"$c $d" <<<"$c $d"

View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
local c d local c d
for d in *(FDN); do for d in *(FDN); do
print $(find $d 2>/dev/null | wc -l) $d print $(find $d 2>/dev/null | wc -l) $d

2
sh/dfu
View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
df -xtmpfs | awk ' df -xtmpfs | awk '
NR==1{printf"%-20s %7s %7s %7s %7s\n","Filesystem","Used","Max","Left","Misc"} NR==1{printf"%-20s %7s %7s %7s %7s\n","Filesystem","Used","Max","Left","Misc"}
NR>1{printf"%-20s %7.2f %7.2f %7.2f %7.2f\n",$6,$3/2^20,($3+$4)/2^20,($4)/2^20,($2-$4-$3)/2^20}' NR>1{printf"%-20s %7.2f %7.2f %7.2f %7.2f\n",$6,$3/2^20,($3+$4)/2^20,($4)/2^20,($2-$4-$3)/2^20}'

2
sh/e
View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
local editor=(${=EDITOR}) local editor=(${=EDITOR})
local running=0 local running=0

2
sh/hex
View file

@ -1,2 +1,2 @@
#!/bin/zsh #!/usr/bin/env zsh
printf "%08X\n" "$(($@))" printf "%08X\n" "$(($@))"

2
sh/lsz
View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
emulate -L zsh emulate -L zsh
setopt ksh_typeset typeset_silent setopt ksh_typeset typeset_silent

View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
# crontab usage: # crontab usage:
#* * * * * minutemaid 9 cd repo && git pull # runs every nine minutes #* * * * * minutemaid 9 cd repo && git pull # runs every nine minutes

View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
local bottom=0 strip=0 interval=2 opt= local bottom=0 strip=0 interval=2 opt=
while getopts 'fsn:h' opt; do while getopts 'fsn:h' opt; do
case $opt in case $opt in

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
# the first expression is taken from this FAQ: # the first expression is taken from this FAQ:
# https://perldoc.perl.org/perlfaq6.html#How-do-I-use-a-regular-expression-to-strip-C-style-comments-from-a-file%3f # https://perldoc.perl.org/perlfaq6.html#How-do-I-use-a-regular-expression-to-strip-C-style-comments-from-a-file%3f
noccom() { noccom() {

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
expac -s '%m %n' | awk ' expac -s '%m %n' | awk '
{t+=$1;printf("%8.2fM %s\n",$1/(1024*1024),$2)} {t+=$1;printf("%8.2fM %s\n",$1/(1024*1024),$2)}
END{printf("%8.2fM\n",t/(1024*1024))} END{printf("%8.2fM\n",t/(1024*1024))}

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
ps axco rss,pid,command | awk ' ps axco rss,pid,command | awk '
NR>1&&$1>0{t+=$1;printf("%8.2fM %7d %s\n",$1/1024,$2,$3)} NR>1&&$1>0{t+=$1;printf("%8.2fM %7d %s\n",$1/1024,$2,$3)}
END{printf("%8.2fM\n",t/1024)} END{printf("%8.2fM\n",t/1024)}

View file

@ -1,2 +1,2 @@
#!/bin/sh #!/usr/bin/env sh
find -maxdepth 1 -type d \( -path '/root' -prune -o -print \) | tail -n+2 | shuf | head -1 find -maxdepth 1 -type d \( -path '/root' -prune -o -print \) | tail -n+2 | shuf | head -1

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
awk ' awk '
{ {
i=0 i=0

View file

@ -1,3 +1,3 @@
#!/bin/zsh #!/usr/bin/env zsh
# from https://github.com/sorin-ionescu/prezto/ # from https://github.com/sorin-ionescu/prezto/
awk "{ print ${(j:,:):-\$${^@}} }" awk "{ print ${(j:,:):-\$${^@}} }"

View file

@ -1,4 +1,4 @@
#!/bin/zsh #!/usr/bin/env zsh
# via: https://github.com/sorin-ionescu/prezto/ # via: https://github.com/sorin-ionescu/prezto/
# this version uses tabs for input/output field separators. # this version uses tabs for input/output field separators.
awk "BEGIN { FS=\"\\t\"; OFS=\"\\t\" } { print ${(j:,:):-\$${^@}} }" awk "BEGIN { FS=\"\\t\"; OFS=\"\\t\" } { print ${(j:,:):-\$${^@}} }"