1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-20 02:43:23 -07: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.
[ -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 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' "$@" \
|| ls -lAX --group-directories-first --color=force "$@"; } | less

View File

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

View File

@ -1,4 +1,4 @@
#!/bin/zsh
#!/usr/bin/env zsh
# awful things
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
aur() {
trap 'exit 1' SIGINT SIGTERM

View File

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

View File

@ -1,4 +1,4 @@
#!/bin/zsh
#!/usr/bin/env zsh
local c d
for d in *(FDN); do
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 '
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}'

2
sh/e
View File

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

2
sh/hex
View File

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

2
sh/lsz
View File

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

View File

@ -1,4 +1,4 @@
#!/bin/zsh
#!/usr/bin/env zsh
# crontab usage:
#* * * * * 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=
while getopts 'fsn:h' opt; do
case $opt in

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
# 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
noccom() {

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
expac -s '%m %n' | awk '
{t+=$1;printf("%8.2fM %s\n",$1/(1024*1024),$2)}
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 '
NR>1&&$1>0{t+=$1;printf("%8.2fM %7d %s\n",$1/1024,$2,$3)}
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

View File

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

View File

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

View File

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