Initial import

This commit is contained in:
Lucas 2019-09-11 02:11:40 +00:00
當前提交 3779fdce2c
共有 48 個文件被更改,包括 2012 次插入0 次删除

113
COPYING Normal file
查看文件

@ -0,0 +1,113 @@
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific
works ("Commons") that the public can reliably and without fear of later
claims of infringement build upon, modify, incorporate in other works, reuse
and redistribute as freely as possible in any form whatsoever and for any
purposes, including without limitation commercial purposes. These owners may
contribute to the Commons to promote the ideal of a free culture and the
further production of creative, cultural and scientific works, or to gain
reputation or greater distribution for their Work in part through the use and
efforts of others.
For these and/or other purposes and motivations, and without any expectation
of additional consideration or compensation, the person associating CC0 with a
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
and publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not limited
to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
the Waiver for the benefit of each member of the public at large and to the
detriment of Affirmer's heirs and successors, fully intending that such Waiver
shall not be subject to revocation, rescission, cancellation, termination, or
any other legal or equitable action to disrupt the quiet enjoyment of the Work
by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
is so judged Affirmer hereby grants to each affected person a royalty-free,
non transferable, non sublicensable, non exclusive, irrevocable and
unconditional license to exercise Affirmer's Copyright and Related Rights in
the Work (i) in all territories worldwide, (ii) for the maximum duration
provided by applicable law or treaty (including future time extensions), (iii)
in any current or future medium and for any number of copies, and (iv) for any
purpose whatsoever, including without limitation commercial, advertising or
promotional purposes (the "License"). The License shall be deemed effective as
of the date CC0 was applied by Affirmer to the Work. Should any part of the
License for any reason be judged legally invalid or ineffective under
applicable law, such partial invalidity or ineffectiveness shall not
invalidate the remainder of the License, and in such case Affirmer hereby
affirms that he or she will not (i) exercise any of his or her remaining
Copyright and Related Rights in the Work or (ii) assert any associated claims
and causes of action with respect to the Work, in either case contrary to
Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or otherwise,
including without limitation warranties of title, merchantability, fitness
for a particular purpose, non infringement, or the absence of latent or
other defects, accuracy, or the present or absence of errors, whether or not
discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without limitation
any person's Copyright and Related Rights in the Work. Further, Affirmer
disclaims responsibility for obtaining any necessary consents, permissions
or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.

66
Makefile Normal file
查看文件

@ -0,0 +1,66 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
.POSIX:
.SUFFIXES:
PREFIX= $(HOME)
DIRS= bin dotfiles spoon themes utils xdg-config-dir
all: install
clean: clean-bin clean-dotfiles clean-themes
rm -f env.tgz
clean-bin:
cd bin && $(MAKE) clean
clean-dotfiles:
cd dotfiles && $(MAKE) clean
clean-themes:
cd themes && $(MAKE) clean
diff: diff-dotfiles diff-xdg-config-dir
diff-dotfiles:
-cd dotfiles && $(MAKE) diff
diff-xdg-config-dir:
-cd xdg-config-dir && $(MAKE) diff
dist: clean
mkdir -p env.dist-tmp
cp -fr Makefile $(DIRS) env.dist-tmp
pax -ws "/.dist-tmp//" env.dist-tmp | gzip >env.tgz
rm -fr env.dist-tmp
install: install-bin install-dotfiles install-xdg-config-dir
install-bin:
cd bin && $(MAKE) install
install-dotfiles:
cd dotfiles && $(MAKE) install
install-xdg-config-dir:
cd xdg-config-dir && $(MAKE) install
uninstall: uninstall-bin uninstall-dotfiles uninstall-xdg-config-dir
uninstall-bin:
cd bin && $(MAKE) uninstall
uninstall-dotfiles:
cd dotfiles && $(MAKE) uninstall
uninstall-xdg-config-dir:
cd xdg-config-dir && $(MAKE) uninstall

30
bin/Makefile Normal file
查看文件

@ -0,0 +1,30 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
.POSIX:
.SUFFIXES:
.SUFFIXES: .sh .c
PREFIX= $(HOME)
BIN= ZZZ browser credentials fetch imgresize invidious rfcopen screenshot \
tor-browser w3m-copy-link xsekrit
all: $(BIN)
clean:
rm -f $(BIN)
install: all
mkdir -p $(PREFIX)/bin
cp -f $(BIN) $(PREFIX)/bin
cd $(PREFIX)/bin && chmod 555 $(BIN)
uninstall:
cd $(PREFIX)/bin && rm -f $(BIN)

23
bin/ZZZ.sh Normal file
查看文件

@ -0,0 +1,23 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
doas true || exit $?
printf "Hibernating in";
for i in 3 2 1; do
printf " %d..." $i
sleep 1
done
printf " now!\n"
doas /usr/sbin/ZZZ "$@"
doas -L

15
bin/browser.sh Normal file
查看文件

@ -0,0 +1,15 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
scp ~/.Xauthority _browser@localhost:
ssh -n _browser@localhost -- \
env DISPLAY=${DISPLAY:-:0} /usr/local/bin/firefox "$@"

109
bin/credentials.sh Normal file
查看文件

@ -0,0 +1,109 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage() {
cat - <<. >&2
Usage:
${0##*/} [-2pu] service
.
exit 1
}
clip() { xclip -q -r -l 1 -sel clip 2>/dev/null; }
get_user() {
echo user
sekrit get services/"$1"/user | clip
}
get_pass() {
echo pass
sekrit get services/"$1"/pass | clip
}
get_2fa() {
echo 2fa
otpcli_opts=
case $1 in
isnic) otpcli_opts="-H sha512 -d 8"
;;
esac
sekrit get services/"$1"/2fa | otpcli $otpcli_opts | clip
}
get_from_flags() {
user=$1
pass=$2
sfa=$3
s=$4
if [ $user = yes ] && ! sekrit has services/"$s"/user; then
printf "%s: service \"%s\" has no user.\n" \
"${0##*/}" "$s" >&2
exit 1
fi
if [ $pass = yes ] && ! sekrit has services/"$s"/pass; then
printf "%s: service \"%s\" has no pass.\n" \
"${0##*/}" "$s" >&2
exit 1
fi
if [ $sfa = yes ] && ! sekrit has services/"$s"/2fa; then
printf "%s: service \"%s\" has no 2fa.\n" \
"${0##*/}" "$s" >&2
exit 1
fi
[ $user = yes ] && get_user "$s"
[ $pass = yes ] && get_pass "$s"
[ $sfa = yes ] && get_2fa "$s"
}
get_all() {
s=$1
if ! sekrit has services/"$s"/pass; then
printf "%s: Unknown service \"%s\".\n" \
"${0##*/}" "$s" >&2
exit 1
fi
sekrit has services/"$s"/user && get_user "$s"
get_pass "$s"
sekrit has services/"$s"/2fa && get_2fa "$s"
}
sfa=no
pass=no
user=no
while getopts 2pu flag; do
case $flag in
2) sfa=yes
;;
p) pass=yes
;;
u) user=yes
;;
*) usage
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -ne 1 ] || [ -z "$1" ]; then
usage
fi
service=$1
if [ $sfa = yes ] || [ $pass = yes ] || [ $user = yes ]; then
get_from_flags $user $pass $sfa "$service"
else
get_all "$service"
fi

62
bin/fetch.sh Normal file
查看文件

@ -0,0 +1,62 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage() {
printf "Usage: %s [-T] URL [URLs...]\n" "${0##*/}">&2
exit 1
}
torsocks=torsocks
while getopts T flag; do
case $flag in
T) torsocks=
;;
*) usage
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then
usage
fi
: ${ARCHIVE_BASEDIR:=~/tmp/archive}
mkdir -p "$ARCHIVE_BASEDIR"
everything=$ARCHIVE_BASEDIR/everything
test -f "$everything" || touch "$everything"
dir=$ARCHIVE_BASEDIR/$(date +%Y/%m/%d)
mkdir -p "$dir" || exit 1
rc=0
for url; do
sha=$(printf "%s" "$url" | sha256)
outdir=$dir/$sha
if grep -q "^$url\$" "$everything"; then
printf "%s: \"%s\" already fetched.\n" "${0##*/}" "$url" >&2
printf "%s\n" "$outdir/file"
continue
fi
mkdir -p "$outdir"
{
$torsocks ftp -o "$outdir/file" "$url" \
&& printf "%s\n" "$url" >"$outdir/url" \
&& printf "%s\n" "$name" >"$outdir/name" \
&& printf "%s\n" "$url" >>"$everything" \
&& printf "%s\n" "$outdir/file"
} || rc=1
done
exit $rc

74
bin/imgresize.sh Normal file
查看文件

@ -0,0 +1,74 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage() {
cat - <<. >&2
Usage:
${0##*/} size in-file out-file
"size" is WxH or Wx or xH.
.
exit 1
}
check_dimension_format() {
printf "%s\n" "$1" | grep -q "^[0-9]*x[0-9]*\$" \
&& [ "$1" != "x" ]
}
if [ $# -ne 3 ] || ! check_dimension_format "$1"; then
usage
fi
if [ -z "$2" ]; then
printf "%s: Input file name can't be empty.\n" \
"${0##*/}" >&2
exit 1
fi
if [ -z "$3" ]; then
printf "%s: Output file name can't be empty.\n" \
"${0##*/}" >&2
exit 1
fi
size=$1
w=${size#x*}
h=${size%*x}
infile=$2
outfile=$3
inprog=
case $infile in
*.jpg | *.jpeg)
inprog=jpegtopnm
;;
*.png) inprog=pngtopam
;;
*) printf "%s: Unknown input format.\n" "${0##*/}" >&2
exit 1
;;
esac
outprog=
case $outfile in
*.jpg | *.jpeg)
outprog=pnmtojpeg
;;
*.png) outprog=pamtopng
;;
*) printf "%s: Unknown output format.\n" "${0##*/}" >&2
exit 1
;;
esac
"$inprog" <"$infile" \
| pamscale ${w:+-width "$w"} ${h:+-height "$h"} \
| "$outprog" >"$outfile"

54
bin/invidious.sh Normal file
查看文件

@ -0,0 +1,54 @@
#!/bin/sh
# env
# Written in 2019 by Leslie
# Modified in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage() {
printf "Usage: %s url\n" "${0##*/}" >&2
exit 1
}
if [ $# -ne 1 ]; then
usage
fi
case $1 in
"https://invidio.us/watch?v="*)
;;
*) printf "%s: Not an invidio.us url.\n" "${0##*/}" >&2
exit 1
esac
video_id=
for param in $(printf "%s\n" "${1##*"?"}" | tr "&" "\n"); do
k=${param%%=*}
[ "$k" = v ] || continue
v=${param#*=}
if [ ${#v} -ne 11 ]; then
printf "%s: "%s": not a video id.\n" "${0##*/}" "$v" >&2
continue
fi
video_id=$v
break
done
if [ -z "$video_id" ]; then
printf "%s: no video ID in URL.\n" "${0##*/}" >&2
exit 1
fi
dl_option=$(ftp -o - "$1" 2>/dev/null \
| grep "<option value='{" \
| head -n 1 | cut -d "\"" -f 8)
printf "https://invidio.us/latest_version?id=%s&itag=%s\n" \
"$video_id" "$dl_option"

49
bin/rfcopen.sh Normal file
查看文件

@ -0,0 +1,49 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage() {
printf "Usage: %s [-T] rfc-number\n" "${0##*/}" >&2
exit 1
}
tonumber() {
printf "%u" "$1" 2>/dev/null
}
: ${RFCDIR:=~/doc/rfc}
torsocks=torsocks
while getopts T flag; do
case $flag in
T) torsocks=
;;
*) usage
;;
esac
done
shift $(($OPTIND - 1))
if [ $# -ne 1 ] || [ -z "$1" ] || ! n=$(tonumber "$1"); then
usage
fi
rfcfile=$RFCDIR/rfc$n.txt
url=https://tools.ietf.org/rfc/rfc$n.txt
mkdir -p "$RFCDIR"
if [ ! -f "$rfcfile" ]; then
if ! $torsocks ftp -Vo "$rfcfile" "$url"; then
printf "%s: Couldn't fetch RFC %u\n" "${0##*/}" "$n" >&2
exit 1
fi
fi
${PAGER:-more} "$rfcfile"

52
bin/screenshot.sh Normal file
查看文件

@ -0,0 +1,52 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage() {
cat - <<. >&2
Usage:
${0##*/}
${0##*/} -id id
${0##*/} -name name
${0##*/} -window
.
exit 1
}
save_screenshot() {
xwdtopnm | pnmtopng >~/media/ss/"$(date +%Y%m%d-%H%M%S)".png
}
case $# in
0) xwd -silent -root | save_screenshot
;;
1) if [ "$1" != "-window" ]; then
printf "%s: Unknown option \"%s\".\n" \
"${0##*/}" "$1" >&2
exit 1
fi
xwd -silent | save_screenshot
;;
2) if [ "$1" != "-id" ] && [ "$1" != "-name" ]; then
printf "%s: Unknown option \"%s\".\n" \
"${0##*/}" "$1" >&2
exit 1
fi
if [ -z "$2" ]; then
printf "%s: %s expects a non-empty parameter.\n" \
"${0##*/}" "$1" >&2
exit 1
fi
xwd -silent "$1" "$2" | save_screenshot
;;
*) usage
;;
esac

15
bin/tor-browser.sh Normal file
查看文件

@ -0,0 +1,15 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
scp ~/.Xauthority _browser@localhost:
ssh -n _browser@localhost -- \
env DISPLAY=${DISPLAY:-:0} /usr/local/bin/tor-browser "$@"

13
bin/w3m-copy-link.sh Normal file
查看文件

@ -0,0 +1,13 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
printf "%s" "$*" | xclip -sel clip

23
bin/xsekrit.sh Normal file
查看文件

@ -0,0 +1,23 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
clip() { xclip -q -l 1 -sel clip 2>/dev/null; }
if [ $# -ne 1 ] || [ -z "$1" ]; then
printf "Usage: %s key\n" "${0##*/}" >&2
exit 1
fi
if ! sekrit has "$1"; then
printf "%s: Unknown key \"%s\".\n" "${0##*/}" "$1" >&2
exit 1
fi
sekrit get "$1" | clip

31
dotfiles/Makefile Normal file
查看文件

@ -0,0 +1,31 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
.POSIX:
.SUFFIXES:
PREFIX= $(HOME)
FILES= Xdefaults gitconfig mg nexrc profile shrc tmux.conf xinitrc
all: install
clean: ;
diff:
-for f in $(FILES); do diff -u "$$f" $(PREFIX)/."$$f"; done
install:
for f in $(FILES); do cp -fv "$$f" $(PREFIX)/."$$f"; done
ln -fs $(PREFIX)/.xinitrc $(PREFIX)/.xsession
uninstall:
for f in $(FILES); do rm -f $(PREFIX)/."$$f"; done
rm -f $(PREFIX)/.xsession

78
dotfiles/Xdefaults Normal file
查看文件

@ -0,0 +1,78 @@
! env
! Written in 2019 by Lucas
! CC0 1.0 Universal/Public domain - No rights reserved
!
! To the extent possible under law, the author(s) have dedicated all
! copyright and related and neighboring rights to this software to the
! public domain worldwide. This software is distributed without any
! warranty. You should have received a copy of the CC0 Public Domain
! Dedication along with this software. If not, see
! <http://creativecommons.org/publicdomain/zero/1.0/>.
! xterm
XTerm.termName: xterm-256color
XTerm.VT100.loginShell: true
XTerm.VT100.backarrowKey: false
XTerm.VT100.backarrowKeyIsErase: true
XTerm.VT100.bellIsUrgent: true
XTerm.VT100.charClass: 33-47:48,58-64:48,91-96:48,123-126:48
XTerm.VT100.deleteIsDEL: false
XTerm.VT100.metaSendsEscape: true
XTerm.VT100.translations: #override \n\
Ctrl Alt <Key>C: copy-selection(CLIPBOARD) \n\
Ctrl Alt <Key>V: insert-selection(CLIPBOARD) \n\
Ctrl Shift <Key>C: copy-selection(SELECT) \n\
Ctrl Shift <Key>V: insert-selection(SELECT)
XTerm.VT100.saveLines: 2000
XTerm.VT100.scrollBar: false
XTerm.VT100.scrollTtyOutput: false
XTerm.VT100.scrollKey: true
!XTerm.VT100.font: -lucy-tewi-medium-r-normal--11-90-100-100-c-60-iso10646-1
!XTerm.VT100.boldFont: -lucy-tewi-bold-r-normal--11-80-100-100-c-60-iso10646-1
XTerm.VT100.font: -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso10646-1
XTerm.VT100.boldFont: -misc-fixed-medium-r-bold--13-120-75-75-c-70-iso10646-1
XTerm.VT100.faceName: monospace:size=9
XTerm.VT100.faceNameDoublesize: M+ 2p:size=9
XTerm.VT100.color0: #000000
XTerm.VT100.color1: #cc2900
XTerm.VT100.color2: #29cc00
XTerm.VT100.color3: #cca300
XTerm.VT100.color4: #0029cc
XTerm.VT100.color5: #cc00a3
XTerm.VT100.color6: #00a3cc
XTerm.VT100.color7: #cccccc
XTerm.VT100.color8: #333333
XTerm.VT100.color9: #ff5c33
XTerm.VT100.color10: #5cff33
XTerm.VT100.color11: #ffd633
XTerm.VT100.color12: #335cff
XTerm.VT100.color13: #ff33d6
XTerm.VT100.color14: #33d6ff
XTerm.VT100.color15: #ffffff
XTerm.VT100.background: #0d0a00
XTerm.VT100.foreground: #fffcf2
! ssh-askpass
SshAskpass.grabKeyboard: False
SshAskpass.grabPointer: False
!SshAskpass*font: -lucy-tewi-medium-r-normal--11-90-100-100-c-60-iso10646-1
!SshAskpass*fixedFont: -lucy-tewi-bold-r-normal--11-80-100-100-c-60-iso10646-1
SshAskpass*font: -misc-fixed-medium-r-normal--13-120-75-75-c-70-iso10646-1
SshAskpass*fixedFont: -misc-fixed-medium-r-bold--13-120-75-75-c-70-iso10646-1
SshAskpass*foreground: #fffcf2
SshAskpass*background: #0d0a00
SshAskpass*bottomShadowColor: #cca300
SshAskpass*topShadowColor: #ffd633
SshAskpass.shadowThickness: 0
SshAskpass.Button.shadowThickness: 2
SshAskpass.Indicator.shadowThickness: 0
SshAskpass.Indicator.foreground: #33d6ff
SshAskpass.Indicator.background: #00a3cc
SshAskpass.Indicator.width: 4
SshAskpass.Indicator.height: 1
SshAskpass.Indicator.horizontalSpacing: 2
SshAskpass.Indicator.minimumCount: 10
SshAskpass.Indicator.maximumCount: 10

41
dotfiles/gitconfig Normal file
查看文件

@ -0,0 +1,41 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
[user]
name = Lucas
email = lucas@domain.invalid
[core]
editor = ed
excludesfile = ~/.gitignore
[color]
ui = never
[format]
coverletter = auto
thread = shallow
[alias]
a = add -p
br = branch
ci = commit -v
cia = commit -v --amend
co = checkout
prb = pull --rebase
rb = rebase
rbc = rebase --continue
rbi = rebase -i --autosquash
st = status -s
tree = log --all --graph --pretty='%h%d %aN: %s'
[push]
default = simple

22
dotfiles/mg Normal file
查看文件

@ -0,0 +1,22 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
global-set-key "\^w" backward-kill-word
global-set-key "\^x " set-mark-command
global-set-key "\^x\^z" suspend-emacs
global-set-key "\^xw" kill-region
global-set-key "\^z" undo
auto-indent-mode 1
backup-to-home-directory 1
column-number-mode 1
make-backup-files 1
set-default-mode indent

18
dotfiles/nexrc Normal file
查看文件

@ -0,0 +1,18 @@
" env
" Written in 2019 by Lucas
" CC0 1.0 Universal/Public domain - No rights reserved
"
" To the extent possible under law, the author(s) have dedicated all
" copyright and related and neighboring rights to this software to the
" public domain worldwide. This software is distributed without any
" warranty. You should have received a copy of the CC0 Public Domain
" Dedication along with this software. If not, see
" <http://creativecommons.org/publicdomain/zero/1.0/>.
set autoindent
set iclower
set leftright
set ruler
set showmatch
set showmode
set wrapscan

24
dotfiles/profile Normal file
查看文件

@ -0,0 +1,24 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
# Mostly taken from OpenBSD's stock .profile
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games
PATH=$HOME/bin:$HOME/local/bin:$PATH
LC_CTYPE="en_US.UTF-8"
export PATH HOME TERM LC_CTYPE
case "$-" in
*i*)
case "$SHELL" in
/bin/bash) . ~/.shrc ;;
/bin/ksh | /bin/loksh | /bin/mksh) export ENV=~/.shrc ;;
esac
esac

47
dotfiles/shrc Normal file
查看文件

@ -0,0 +1,47 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
\unalias -a
EDITOR=ed
PAGER=less
VISUAL=ed
export EDITOR PAGER VISUAL
GPG_TTY=$(tty)
export GPG_TTY
alias cp="cp -i"
alias l="ls -F"
alias la="ls -aF"
alias ll="ls -lF"
alias mv="mv -i"
alias p="$PAGER"
if [ -d ~/local/man ]; then
alias man="/usr/bin/man -m ~/local/man"
fi
case $SHELL in
/bin/mksh)
PS1='${HOSTNAME:=$(hostname -s)}\$ '
;;
*) PS1='\h\$ '
;;
esac
export PS1
case $(uname -s) in
Linux) stty erase ^?
;;
esac
set -o emacs

18
dotfiles/tmux.conf Normal file
查看文件

@ -0,0 +1,18 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
set -g default-terminal "tmux-256color"
set -g mouse off
set -g automatic-rename off
set -g base-index 1
bind A set -w synchronize-panes on
bind a set -w synchronize-panes off

27
dotfiles/xinitrc Executable file
查看文件

@ -0,0 +1,27 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
test -r ~/.profile && . ~/.profile
setxkbmap \
-layout us \
-variant altgr-intl \
-option compose:menu -option ctrl:nocaps
xset r rate 330 75
xset b off
test -d /usr/local/share/fonts/bitmaps \
&& xset +fp /usr/local/share/fonts/bitmaps \
&& xset fp rehash
test -r ~/.Xresources && xrdb -merge ~/.Xresources
exec herbstluftwm -l >~/local/var/log/herbstluftwm 2>&1

11
spoon/config.h-Linux Normal file
查看文件

@ -0,0 +1,11 @@
/* delay between each update in seconds */
int delay = 1;
struct ent ents[] = {
/* reorder/remove these as you see fit */
/*{ .fmt = "%s | ", .read = mpdread, .arg = &(struct mpdarg){ .host = NULL, .port = 0 } },*/
{ .fmt = "%%{r}i7 %s'C | ", .read = tempread, .arg = "/sys/class/hwmon/hwmon0/temp1_input" },
{ .fmt = "%s | ", .read = netspeedread, .arg = "enp11s0" },
{ .fmt = "V%s%% | ", .read = mixread, .arg = NULL },
{ .fmt = "%s", .read = dateread, .arg = &(struct datearg){ .fmt = "%a %d %b %T", .tz = "UTC" } },
};

30
spoon/config.h-OpenBSD Normal file
查看文件

@ -0,0 +1,30 @@
/* delay between each update in seconds */
int delay = 1;
#define lbc0 "%%{F#000000}"
#define lbc1 "%%{F#cc2900}"
#define lbc2 "%%{F#29cc00}"
#define lbc3 "%%{F#cca300}"
#define lbc4 "%%{F#0029cc}"
#define lbc5 "%%{F#cc00a3}"
#define lbc6 "%%{F#00a3cc}"
#define lbc7 "%%{F#cccccc}"
#define lbc8 "%%{F#333333}"
#define lbc9 "%%{F#ff5c33}"
#define lbc10 "%%{F#5cff33}"
#define lbc11 "%%{F#ffd633}"
#define lbc12 "%%{F#335cff}"
#define lbc13 "%%{F#ff33d6}"
#define lbc14 "%%{F#33d6ff}"
#define lbc15 "%%{F#ffffff}"
#define lbreset "%%{F-}"
struct ent ents[] = {
/* reorder/remove these as you see fit */
{ .fmt = "%%{r}i5 %s'C " lbc14 "| " lbreset, .read = tempread, .arg = NULL },
{ .fmt = "%s ", .read = wifiread, .arg = NULL },
{ .fmt = "%s " lbc14 "| " lbreset, .read = netspeedread, .arg = "trunk0" },
{ .fmt = "B%s%% ", .read = battread, .arg = NULL },
{ .fmt = "V%s%% " lbc14 "| " lbreset, .read = mixread, .arg = NULL },
{ .fmt = "%s", .read = dateread, .arg = &(struct datearg){ .fmt = "%a %d %b %T", .tz = "UTC" } },
};

34
themes/Makefile Normal file
查看文件

@ -0,0 +1,34 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
.POSIX:
.SUFFIXES:
.SUFFIXES: .c .in .txt .png
LDLIBS= -lm
THEMES= blueie brightie brightie2 brightie3 brightie4
.c:
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
.in.txt:
./colorscheme <"$<" >"$@"
.in.png:
./colorscheme -i <"$<" | pnmtopng >"$@"
all: colorscheme
clean:
rm -f colorscheme $(THEMES:=.png) $(THEMES:=.txt)
show: $(THEMES:=.png) $(THEMES:=.txt)
$(THEMES:=.png) $(THEMES:=.txt): all

19
themes/blueie.in Normal file
查看文件

@ -0,0 +1,19 @@
rgbhex 00 00 11
rgbhex 00 00 11
rgbhex cc 22 22
rgbhex 22 88 22
rgbhex dd aa 44
rgbhex 22 66 cc
rgbhex 99 66 cc
rgbhex 66 aa dd
rgbhex cc cc cc
rgbhex ff ff ee
rgbhex 33 33 44
rgbhex ff 22 22
rgbhex 44 cc 44
rgbhex ff cc 44
rgbhex 44 88 ff
rgbhex cc 66 ff
rgbhex 88 cc ff
rgbhex ff ff ff

18
themes/brightie-old Normal file
查看文件

@ -0,0 +1,18 @@
XTerm.VT100.color0: #000000
XTerm.VT100.color1: #99503d
XTerm.VT100.color2: #4f993d
XTerm.VT100.color3: #99873d
XTerm.VT100.color4: #3d5099
XTerm.VT100.color5: #993d87
XTerm.VT100.color6: #3d8799
XTerm.VT100.color7: #bfbfbf
XTerm.VT100.color8: #404040
XTerm.VT100.color9: #ff5c33
XTerm.VT100.color10: #5cff33
XTerm.VT100.color11: #ffd633
XTerm.VT100.color12: #335cff
XTerm.VT100.color13: #ff33d6
XTerm.VT100.color14: #33d6ff
XTerm.VT100.color15: #ffffff
XTerm.VT100.foreground: #fffcf2
XTerm.VT100.background: #0d0a00

19
themes/brightie.in Normal file
查看文件

@ -0,0 +1,19 @@
hsv 48 1.0 0.05
hsv 0 0.0 0.0
hsv 12 0.6 0.6
hsv 108 0.6 0.6
hsv 48 0.6 0.6
hsv 228 0.6 0.6
hsv 312 0.6 0.6
hsv 192 0.6 0.6
hsv 0 0.0 0.75
hsv 48 0.05 1.0
hsv 0 0.0 0.25
hsv 12 0.8 1.0
hsv 108 0.8 1.0
hsv 48 0.8 1.0
hsv 228 0.8 1.0
hsv 312 0.8 1.0
hsv 192 0.8 1.0
hsv 0 0.0 1.0

19
themes/brightie2.in Normal file
查看文件

@ -0,0 +1,19 @@
hsv 48 1.0 0.05
hsv 0 0.0 0.0
hsv 12 1.0 0.6
hsv 108 1.0 0.6
hsv 48 1.0 0.6
hsv 228 1.0 0.6
hsv 312 1.0 0.6
hsv 192 1.0 0.6
hsv 0 0.0 0.75
hsv 48 0.05 1.0
hsv 0 0.0 0.25
hsv 12 0.8 1.0
hsv 108 0.8 1.0
hsv 48 0.8 1.0
hsv 228 0.8 1.0
hsv 312 0.8 1.0
hsv 192 0.8 1.0
hsv 0 0.0 1.0

19
themes/brightie3.in Normal file
查看文件

@ -0,0 +1,19 @@
hsv 48 1.0 0.05
hsv 0 0.0 0.0
hsv 12 1.0 0.7
hsv 108 1.0 0.7
hsv 48 1.0 0.7
hsv 228 1.0 0.7
hsv 312 1.0 0.7
hsv 192 1.0 0.7
hsv 0 0.0 0.7
hsv 48 0.05 1.0
hsv 0 0.0 0.25
hsv 12 0.8 1.0
hsv 108 0.8 1.0
hsv 48 0.8 1.0
hsv 228 0.8 1.0
hsv 312 0.8 1.0
hsv 192 0.8 1.0
hsv 0 0.0 1.0

19
themes/brightie4.in Normal file
查看文件

@ -0,0 +1,19 @@
hsv 48 1.0 0.05
hsv 0 0.0 0.0
hsv 12 1.0 0.8
hsv 108 1.0 0.8
hsv 48 1.0 0.8
hsv 228 1.0 0.8
hsv 312 1.0 0.8
hsv 192 1.0 0.8
hsv 0 0.0 0.8
hsv 48 0.05 1.0
hsv 0 0.0 0.2
hsv 12 0.8 1.0
hsv 108 0.8 1.0
hsv 48 0.8 1.0
hsv 228 0.8 1.0
hsv 312 0.8 1.0
hsv 192 0.8 1.0
hsv 0 0.0 1.0

198
themes/colorscheme.c Normal file
查看文件

@ -0,0 +1,198 @@
/*
* env
* Written in 2019 by Lucas
* CC0 1.0 Universal/Public domain - No rights reserved
*
* To the extent possible under law, the author(s) have dedicated all
* copyright and related and neighboring rights to this software to the
* public domain worldwide. This software is distributed without any
* warranty. You should have received a copy of the CC0 Public Domain
* Dedication along with this software. If not, see
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#include <errno.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LENGTH 50
#define INRANGE(x, a, b) ((a) <= (x) && (x) <= (b))
static void
hsvtorgb(double hsv[3], uint8_t rgb[3])
{
double c, hh, m, x;
double r, g, b;
c = hsv[2] * hsv[1];
hh = hsv[0] / 60.0;
x = c * (1.0 - fabs(fmod(hh, 2.0) - 1.0));
switch ((int)floor(hh == 6.0 ? 0.0 : hh)) {
case 0: r = c; g = x; b = 0; break;
case 1: r = x; g = c; b = 0; break;
case 2: r = 0; g = c; b = x; break;
case 3: r = 0; g = x; b = c; break;
case 4: r = x; g = 0; b = c; break;
case 5: r = c; g = 0; b = x; break;
}
m = hsv[2] - c;
r += m; g += m; b += m;
rgb[0] = round(255 * r);
rgb[1] = round(255 * g);
rgb[2] = round(255 * b);
}
static void
hsltorgb(double hsl[3], uint8_t rgb[3])
{
double c, hh, m, x;
double r, g, b;
c = (1.0 - fabs(2.0 * hsl[2] - 1.0)) * hsl[1];
hh = hsl[0] / 60.0;
x = c * (1.0 - fabs(fmod(hh, 2.0) - 1.0));
switch ((int)floor(hh == 6.0 ? 0.0 : hh)) {
case 0: r = c; g = x; b = 0; break;
case 1: r = x; g = c; b = 0; break;
case 2: r = 0; g = c; b = x; break;
case 3: r = 0; g = x; b = c; break;
case 4: r = x; g = 0; b = c; break;
case 5: r = c; g = 0; b = x; break;
}
m = hsl[2] - c / 2.0;
r += m; g += m; b += m;
rgb[0] = round(255 * r);
rgb[1] = round(255 * g);
rgb[2] = round(255 * b);
}
static void
parsecolorline(const char *s, size_t n, uint8_t rgb[3])
{
double d[3];
unsigned int u[3];
if (sscanf(s, "hsv %lf %lf %lf", &d[0], &d[1], &d[2]) == 3) {
if (!INRANGE(d[0], 0, 360) || !INRANGE(d[1], 0, 1)
|| !INRANGE(d[2], 0, 1))
goto err;
hsvtorgb(d, rgb);
} else if (sscanf(s, "hsl %lf %lf %lf", &d[0], &d[1], &d[2]) == 3) {
if (!INRANGE(d[0], 0, 360) || !INRANGE(d[1], 0, 1)
|| !INRANGE(d[2], 0, 1))
goto err;
hsltorgb(d, rgb);
} else if (sscanf(s, "rgb %u %u %u", &u[0], &u[1], &u[2]) == 3) {
if (!INRANGE(u[0], 0, 255) || !INRANGE(u[1], 0, 255)
|| !INRANGE(u[2], 0, 255))
goto err;
rgb[0] = u[0]; rgb[1] = u[1]; rgb[2] = u[2];
} else if (sscanf(s, "rgbhex %x %x %x", &u[0], &u[1], &u[2]) == 3) {
if (!INRANGE(u[0], 0, 255) || !INRANGE(u[1], 0, 255)
|| !INRANGE(u[2], 0, 255))
goto err;
rgb[0] = u[0]; rgb[1] = u[1]; rgb[2] = u[2];
} else {
err:
fprintf(stderr, "Invalid input: \"%s\".", s);
exit(1);
}
}
static void
readcolorscheme(uint8_t colorscheme[18][3])
{
char *line = NULL;
size_t linesize = 0;
ssize_t linelen;
int nlines = 0;
while ((linelen = getline(&line, &linesize, stdin)) != -1
&& nlines < 18) {
if (linelen == 0 || line[0] == '\n' || line[0] == '#')
continue;
parsecolorline(line, linelen, colorscheme[nlines]);
nlines++;
}
free(line);
if (ferror(stdin)) {
fputs("Input error.\n", stderr);
exit(1);
}
if (nlines < 18) {
fputs("Not enought colors.\n", stderr);
exit(1);
}
}
static void
writecolor(uint8_t rgb[3], int l)
{
int i;
for (i = 0; i < l; i++) {
if (fwrite(rgb, sizeof(rgb[0]), 3, stdout) != 3) {
fputs("Short write.\n", stderr);
exit(1);
}
}
}
static void
do_image(uint8_t colorscheme[18][3])
{
int i, n;
printf("P6\n%u %u 255\n", 9 * LENGTH, 2 * LENGTH);
for (i = 0; i < LENGTH; i++)
for (n = 0; n < 9; n++)
writecolor(colorscheme[n], LENGTH);
for (i = 0; i < LENGTH; i++)
for (n = 9; n < 18; n++)
writecolor(colorscheme[n], LENGTH);
}
static void
do_colors(uint8_t colorscheme[18][3])
{
int n;
for (n = 0; n < 18; n++)
printf("#%02x%02x%02x\n", colorscheme[n][0],
colorscheme[n][1], colorscheme[n][2]);
}
int
main(int argc, char *argv[])
{
uint8_t colorscheme[18][3];
int iflag = 0;
if (argc > 2)
goto usage;
if (argc == 2) {
if (strncmp(argv[1], "-i", 3) != 0)
goto usage;
iflag = 1;
}
readcolorscheme(colorscheme);
if (iflag)
do_image(colorscheme);
else
do_colors(colorscheme);
return 0;
usage:
fprintf(stderr, "Usage: %s [-i]\n", argv[0]);
return 1;
}

27
themes/showcase.sh Normal file
查看文件

@ -0,0 +1,27 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage() {
printf "Usage: %s theme-name [theme-name...]\n" "${0##*/}" >&2
exit 1
}
make
for theme; do
if [ ! -f "$theme".in ]; then
printf "%s: No \"%s.in\" file.\n" "${0##*}" "$theme" >&2
exit 1
fi
./colorscheme <"$theme".in >"$theme".txt
./colorscheme -i <"$theme".in | pnmtopng >"$theme".png
done

二進制
utils/bg/FreeHugsBSD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  大小: 536 KiB

二進制
utils/bg/cyberia-cafe-club.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  大小: 1.2 MiB

查看文件

@ -0,0 +1,34 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
: ${CANVAS_BGCOLOR:="#0d0a00"}
: ${CANVAS_HEIGHT:=768}
: ${CANVAS_WIDTH:=1366}
: ${IMAGE_HEIGHT:=500}
: ${IMAGE_WIDTH:=500}
pos_x=$(($CANVAS_WIDTH - $IMAGE_WIDTH))
pos_y=$((($CANVAS_HEIGHT - $IMAGE_HEIGHT) / 2))
if ! tmpfile=$(mktemp -t bg.XXXXXXXXXX); then
printf "%s: Can't create temporary file.\n" "${0##*/}" >&2
exit 1
fi
trap 'rm -f "$tmpfile"' EXIT INT QUIT TERM
pngtopam -alphapam FreeHugsBSD.png \
| pamscale -width="$IMAGE_WIDTH" -height="$IMAGE_HEIGHT" \
>"$tmpfile"
ppmmake "$CANVAS_BGCOLOR" "$CANVAS_WIDTH" "$CANVAS_HEIGHT" \
| pamcomp -xoff="$pos_x" -yoff="$pos_y" "$tmpfile" \
| pamtopng >FreeHugsBSD-bg.png

查看文件

@ -0,0 +1,34 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
: ${CANVAS_BGCOLOR:="#0d0a00"}
: ${CANVAS_HEIGHT:=768}
: ${CANVAS_WIDTH:=1366}
: ${IMAGE_HEIGHT:=768}
: ${IMAGE_WIDTH:=1080}
pos_x=$((($CANVAS_WIDTH - $IMAGE_WIDTH) / 2))
pos_y=$((($CANVAS_HEIGHT - $IMAGE_HEIGHT) / 2))
if ! tmpfile=$(mktemp -t bg.XXXXXXXXXX); then
printf "%s: Can't create temporary file.\n" "${0##*/}" >&2
exit 1
fi
trap 'rm -f "$tmpfile"' EXIT INT QUIT TERM
pngtopam -alphapam cyberia-cafe-club.png \
| pamscale -width="$IMAGE_WIDTH" -height="$IMAGE_HEIGHT" \
>"$tmpfile"
ppmmake "$CANVAS_BGCOLOR" "$CANVAS_WIDTH" "$CANVAS_HEIGHT" \
| pamcomp -xoff="$pos_x" -yoff="$pos_y" "$tmpfile" \
| pamtopng >cyberia-cafe-club-bg.png

查看文件

@ -0,0 +1,28 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
.POSIX:
.SUFFIXES:
.SUFFIXES: .sh
BIN= attach detach trunk_urndis_hotplug
DEST= /etc/hotplug
all: $(BIN)
clean:
rm -f $(BIN)
install: all
cp $(BIN) $(DEST)
cd $(DEST) && chmod 555 $(BIN)
uninstall:
cd $(DEST) && rm -f $(BIN)

查看文件

@ -0,0 +1,26 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
DEVCLASS=$1
DEVNAME=$2
case $DEVCLASS in
3) case $DEVNAME in
urndis*)
if [ -x /etc/hotplug/trunk_urndis_hotplug ]; then
/etc/hotplug/trunk_urndis_hotplug \
attach trunk0 "$DEVNAME"
fi
;;
esac
;;
esac

查看文件

@ -0,0 +1,26 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
DEVCLASS=$1
DEVNAME=$2
case $DEVCLASS in
3) case $DEVNAME in
urndis*)
if [ -x /etc/hotplug/trunk_urndis_hotplug ]; then
/etc/hotplug/trunk_urndis_hotplug \
detach trunk0 "$DEVNAME"
fi
;;
esac
;;
esac

查看文件

@ -0,0 +1,49 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
usage() {
cat - <<. >&2
Usage:
${0##*/} attach TRUNK_DEV URNDIS_DEV
${0##*/} detach TRUNK_DEV URNDIS_DEV
.
exit 1
}
renew_dhcp_if_needed() {
iface=$1
hostname_if=/etc/hostname."$iface"
[ ! -r "$hostname_if" ] && return
while read -r line; do
[ "$line" = dhcp ] && dhclient "$iface" && break
done <"$hostname_if"
}
if [ $# -ne 3 ] || [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
usage
fi
cmd=$1
trunk=$2
urndis=$3
case $cmd in
attach) ifconfig "$urndis" up
ifconfig "$trunk" trunkport "$urndis"
renew_dhcp_if_needed "$trunk"
;;
detach) # $urndis could be already removed
ifconfig "$trunk" -trunkport "$urndis" 2>/dev/null || true
renew_dhcp_if_needed "$trunk"
;;
*) usage
;;
esac

49
utils/shgit Normal file
查看文件

@ -0,0 +1,49 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
shgit() {
if ! gitdir=$(git rev-parse --git-dir 2>/dev/null) \
|| [ -z "$gitdir" ]; then
return
fi
symbolic=$(git symbolic-ref --short HEAD 2>/dev/null)
hash=$(git rev-parse --short HEAD 2>/dev/null)
name=${symbolic:-${hash:-"?"}}
rb=
rbdir="$gitdir/rebase-merge"
if [ -d "$rbdir" ]; then
rb="REBASE"
read -r name <"$rbdir/head-name"
name=${name##*/}
[ -f "$rbdir/interactive" ] && rb="$rb-i"
rbcount=$(wc -l <"$rbdir/done")
read -r rbtotal <"$rbdir/end"
rb="$rb ${rbcount##* }/$rbtotal"
fi
status=
if [ -z "$(git status --porcelain)" ]; then
status="*"
fi
commits=$(git rev-list --left-right --count @{upstream}...HEAD \
2>/dev/null | {
t=
IFS=" " read -r behind ahead
[ ${behind:-0} -gt 0 ] && t=$t"v$behind"
[ ${ahead:-0} -gt 0 ] && t=$t"^$ahead"
printf "%s" "$t"
})
printf "%s" "$name${rb:+:$rb}${status:+:$status}${commits:+:$commits}"
}

29
utils/termcolors.sh Normal file
查看文件

@ -0,0 +1,29 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
printf " fg on bg "
for i in 0 1 2 3 4 5 6 7; do
tput setab $i 0 0
printf " "
done
printf "\n"
tput sgr0
tput rev
printf " bg on fg "
tput sgr0
for i in 0 1 2 3 4 5 6 7; do
tput setab $(($i + 8)) 0 0
printf " "
done
printf "\n"
tput sgr0

28
xdg-config-dir/Makefile Normal file
查看文件

@ -0,0 +1,28 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
.POSIX:
.SUFFIXES:
PREFIX= $(HOME)
DIRS= herbstluftwm
install:
mkdir -p $(PREFIX)/.config
cp -fr $(DIRS) $(PREFIX)/.config
diff:
-for d in $(DIRS); do for f in "$$d"/*; do \
diff -u "$$f" $(PREFIX)/.config/"$$f"; \
done; done
uninstall:
cd $(PREFIX)/.config && rm -fr $(DIRS)

查看文件

@ -0,0 +1,176 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
if [ -f ~/.config/herbstluftwm/theme ]; then
. ~/.config/herbstluftwm/theme
fi
hc() { herbstclient "$@"; }
hc emit_hook reload
# remove all existing keybindings
hc keyunbind --all
# keybindings
Mod=Mod4
hc keybind $Mod-Shift-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close
# programs
hc keybind $Mod-g spawn plumb
hc keybind $Mod-p spawn dmenu_run \
-p run -fn "$hlwm_face" \
-nb "$hlwm_background" -nf "$hlwm_foreground" \
-sb "$hlwm_background" -sf "$hlwm_color14"
hc keybind $Mod-Shift-Return spawn xterm
hc keybind $Mod-Control-Return spawn xterm -geometry 80x40
hc keybind $Mod-Control-l spawn xlock
hc keybind $Mod-Print spawn screenshot
# basic movement
# focusing clients
hc keybind $Mod-Left focus left
hc keybind $Mod-Down focus down
hc keybind $Mod-Up focus up
hc keybind $Mod-Right focus right
# moving clients
hc keybind $Mod-Shift-Left shift left
hc keybind $Mod-Shift-Down shift down
hc keybind $Mod-Shift-Up shift up
hc keybind $Mod-Shift-Right shift right
# splitting frames
# create an empty frame at the specified direction
hc keybind $Mod-u split bottom 0.5
hc keybind $Mod-o split right 0.5
# let the current frame explode into subframes
hc keybind $Mod-Control-space split explode
# resizing frames
resizestep=0.05
hc keybind $Mod-Control-Left resize left +$resizestep
hc keybind $Mod-Control-Down resize down +$resizestep
hc keybind $Mod-Control-Up resize up +$resizestep
hc keybind $Mod-Control-Right resize right +$resizestep
# tags
hc try rename default 1
for tag in 1:1 2:2 3:3 4:4 5:5 6:6 7:7 8:8 9:9 0:0; do
name=${tag%:*}
key=${tag#*:}
hc try add $name
hc keybind $Mod-$key use $name
hc keybind $Mod-Shift-$key move $name
done
hc load 2 "(split horizontal:0.5:1 (clients max:0) (clients max:0))"
hc load 3 "(clients max:0)"
# cycle through tags
hc keybind $Mod-period use_index +1 --skip-visible
hc keybind $Mod-comma use_index -1 --skip-visible
# layouting
hc keybind $Mod-v set_layout vertical
hc keybind $Mod-h set_layout horizontal
hc keybind $Mod-m set_layout max
hc keybind $Mod-r remove
hc keybind $Mod-s floating toggle
hc keybind $Mod-f fullscreen toggle
hc keybind $Mod-Shift-s pseudotile toggle
# The following cycles through the available layouts within a frame, but skips
# layouts, if the layout change wouldn't affect the actual window positions.
# I.e. if there are two windows within a frame, the grid layout is skipped.
hc keybind $Mod-space \
or , and . compare tags.focus.curframe_wcount = 2 \
. cycle_layout +1 vertical horizontal max vertical grid \
, cycle_layout +1
# mouse
hc mouseunbind --all
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize
# focus
hc keybind $Mod-BackSpace cycle_monitor
hc keybind $Mod-Tab cycle_all +1
hc keybind $Mod-j cycle +1
hc keybind $Mod-Shift-Tab cycle_all -1
hc keybind $Mod-k cycle -1
hc keybind $Mod-c cycle
hc keybind $Mod-i jumpto urgent
# theme
hc attr theme.tiling.reset 1
hc attr theme.floating.reset 1
hc set frame_border_width 0
hc set always_show_frame 0
hc set frame_bg_transparent 1
hc set frame_transparent_width 0
hc set frame_gap 0
hc attr theme.active.color "$hlwm_color11"
hc attr theme.normal.color "$hlwm_color8"
hc attr theme.urgent.color "$hlwm_color9"
hc attr theme.inner_width 0
hc attr theme.outer_width 0
hc attr theme.border_width 2
hc attr theme.background_color "$hlwm_background"
hc set window_gap 0
hc set frame_padding 4
hc set smart_window_surroundings 0
hc set smart_frame_surroundings 0
hc set mouse_recenter_gap 0
# rules
hc unrule -F
#hc rule class=XTerm tag=3 # move all xterms to tag 3
hc rule focus=on # normally focus new clients
#hc rule focus=off # normally do not focus new clients
# give focus to most common terminals
#hc rule class~"(.*[Rr]xvt.*|.*[Tt]erm|Konsole)" focus=on
hc rule windowtype~"_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)" pseudotile=on
hc rule windowtype="_NET_WM_WINDOW_TYPE_DIALOG" focus=on
hc rule windowtype~"_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)" manage=off
hc rule class=XTerm pseudotile=on
hc rule class=Firefox instance=Navigator fullscreen=on tag=3
hc rule class="Tor Browser" pseudotile=on tag=3
hc rule class=SshAskpass pseudotile=on
hc rule class=Snes9x-gtk pseudotile=on
hc set tree_style "╾│ ├└╼─┐"
#hc set tree_style "-| |'>-."
# unlock, just to be sure
hc unlock
hc detect_monitors
if [ -f ~/.config/herbstluftwm/herbstpanel.sh ]; then
font_height=13
bar_height=$(($font_height))
for m in $(hc list_monitors | cut -d : -f 1); do
hc pad "$m" 0 0 $bar_height 0
hc monitor_rect "$m" | {
read -r x y w h
y=$(($y + $h - $bar_height - 1))
printf "%s\t%u\t%u\t%u\t%u\n" \
"$m" "$x" "$y" "$w" $bar_height
}
done | sh ~/.config/herbstluftwm/herbstpanel.sh
fi

查看文件

@ -0,0 +1,83 @@
#!/bin/sh
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
if [ -f ~/.config/herbstluftwm/theme ]; then
. ~/.config/herbstluftwm/theme
fi
tagstatus() {
mon=$1
herbstclient tag_status "$mon" | tr "\t" "\n" | {
out=
while IFS= read -r line; do
[ -z "$line" ] && continue
tag=${line#[.:+#%!-]}
rev=
color=$hlwm_color8
case $line in
:*) color=$hlwm_foreground
;;
[#-]*) color=$hlwm_color14
;;
[%+]*) color=$hlwm_color6
;;
!*) color=$hlwm_color13
focused=$(herbstclient attr tags.focus.name)
if [ "$tag" = "$focused" ]; then
color=$hlwm_color14
fi
;;
esac
o=$o"%{O1}%{U$color+u}%{O5}%{U--u}"
done
printf "%%{c}%s%%{O1}\n" "$o"
}
}
taglist() {
mon=$1
tagstatus "$mon"
herbstclient -i "tag_changed|tag_flags" \
| while read -r discard; do
tagstatus "$mon"
done
}
if [ $# -ne 0 ]; then
printf "Usage: %s monitor x y width height\n" "${0##*/}" >&2
exit 1
fi
while IFS=" " read -r m x y w h; do
left=
center=
right=
{
taglist "$m" &
spoon -t &
} | while IFS= read line; do
case $line in
"%{c}"*)
center=$line
;;
"%{r}"*)
right=$line
;;
esac
printf "%s%s%s\n" "$left" "$center" "$right"
done | lemonbar -g "$w"x"$h"+"$x"+"$y" \
-B "$hlwm_background" -F "$hlwm_foreground" \
-f "$hlwm_font" | sh &
done
herbstclient -w reload >/dev/null
kill 0

查看文件

@ -0,0 +1,33 @@
# env
# Written in 2019 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty. You should have received a copy of the CC0 Public Domain
# Dedication along with this software. If not, see
# <http://creativecommons.org/publicdomain/zero/1.0/>.
: ${hlwm_color0="#000000"}
: ${hlwm_color1="#cc2900"}
: ${hlwm_color2="#29cc00"}
: ${hlwm_color3="#cca300"}
: ${hlwm_color4="#0029cc"}
: ${hlwm_color5="#cc00a3"}
: ${hlwm_color6="#00a3cc"}
: ${hlwm_color7="#cccccc"}
: ${hlwm_color8="#333333"}
: ${hlwm_color9="#ff5c33"}
: ${hlwm_color10="#5cff33"}
: ${hlwm_color11="#ffd633"}
: ${hlwm_color12="#335cff"}
: ${hlwm_color13="#ff33d6"}
: ${hlwm_color14="#33d6ff"}
: ${hlwm_color15="#ffffff"}
: ${hlwm_background="#0d0a00"}
: ${hlwm_foreground="#fffcf2"}
: ${hlwm_font="-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso10646-1"}
#: ${hlwm_font="-lucy-tewi-medium-r-normal--11-90-100-100-c-60-iso10646-1"}
: ${hlwm_face="monospace:size=9"}