diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2024-09-20 14:16:56 +0200 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2024-09-20 14:16:56 +0200 |
commit | 45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a (patch) | |
tree | b564c1c43920def6641cd482a7b4dca453dbc043 /.bin | |
parent | 07dd8e37eb767c3dd6abf63e5e4a720cd778da15 (diff) | |
download | dotfiles-45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a.tar.gz dotfiles-45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a.zip |
Change dotfiles structure, and add guix-channels declaration.
Diffstat (limited to '.bin')
-rwxr-xr-x | .bin/arduino-cli | 14 | ||||
-rwxr-xr-x | .bin/chiaki | 21 | ||||
-rwxr-xr-x | .bin/clean.sh | 3 | ||||
-rwxr-xr-x | .bin/download_music.sh | 26 | ||||
-rwxr-xr-x | .bin/esp_upload.sh | 6 | ||||
-rwxr-xr-x | .bin/file_upload.sh | 38 | ||||
-rwxr-xr-x | .bin/home-reconfigure | 3 | ||||
-rw-r--r-- | .bin/jd-arduino-cli.Dockerfile | 16 | ||||
-rwxr-xr-x | .bin/oath | 14 | ||||
-rwxr-xr-x | .bin/profile-add-all | 9 | ||||
-rwxr-xr-x | .bin/stumpish | 196 | ||||
-rwxr-xr-x | .bin/system-reconfigure | 3 | ||||
-rwxr-xr-x | .bin/update.sh | 4 | ||||
-rwxr-xr-x | .bin/whois-at-hsp | 84 |
14 files changed, 0 insertions, 437 deletions
diff --git a/.bin/arduino-cli b/.bin/arduino-cli deleted file mode 100755 index 7c0d41a..0000000 --- a/.bin/arduino-cli +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
4 | |||
5 | if [[ $(docker images | grep jd-arduino-cli | wc -l) -eq 0 ]] | ||
6 | then | ||
7 | docker build -f "$SCRIPT_DIR/jd-arduino-cli.Dockerfile" -t jd-arduino-cli . | ||
8 | fi | ||
9 | |||
10 | docker run --rm --network none -it --privileged \ | ||
11 | -v $(pwd):/src \ | ||
12 | -v jd-arduino-cli-tmp:/tmp \ | ||
13 | -v /dev:/dev jd-arduino-cli \ | ||
14 | arduino-cli $@ | ||
diff --git a/.bin/chiaki b/.bin/chiaki deleted file mode 100755 index 5fa6547..0000000 --- a/.bin/chiaki +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | CHIAKI_SHELL=/tmp/.chiaki.nix | ||
4 | |||
5 | cat <<EOF > $CHIAKI_SHELL | ||
6 | let | ||
7 | nixgl = import (fetchTarball https://github.com/guibou/nixGL/archive/main.tar.gz) { }; | ||
8 | in | ||
9 | { nixpkgs ? import <nixpkgs> {} }: | ||
10 | with nixpkgs; mkShell { | ||
11 | buildInputs = [ | ||
12 | chiaki | ||
13 | nixgl.auto.nixGLDefault | ||
14 | ]; | ||
15 | shellHook = '' | ||
16 | nixGL chiaki && exit; | ||
17 | ''; | ||
18 | } | ||
19 | EOF | ||
20 | |||
21 | nix-shell $CHIAKI_SHELL | ||
diff --git a/.bin/clean.sh b/.bin/clean.sh deleted file mode 100755 index 3e6bbfd..0000000 --- a/.bin/clean.sh +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | sudo emerge --ask --depclean; | ||
diff --git a/.bin/download_music.sh b/.bin/download_music.sh deleted file mode 100755 index e3a3601..0000000 --- a/.bin/download_music.sh +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | BOLD="\e[1"; | ||
4 | ENDCOLOR="\e[0m"; | ||
5 | Green="32"; | ||
6 | LightRed="31"; | ||
7 | |||
8 | if ! [ $1 ]; then | ||
9 | echo "" | ||
10 | echo -e $BOLD";"";"$LightRed"m Please provide music url!"$ENDCOLOR | ||
11 | echo "" | ||
12 | exit | ||
13 | fi | ||
14 | |||
15 | MUSIC_DIR="~/Documents/Music/%(artist)s/%(album)s/%(title)s-%(id)s.%(ext)s" | ||
16 | if [ $2 ]; then | ||
17 | MUSIC_DIR="${a}/%(artist)s/%(album)s/%(title)s-%(id)s.%(ext)s" | ||
18 | fi | ||
19 | |||
20 | echo "" | ||
21 | echo -e $BOLD";"";"$Green"m Music will download to ${MUSIC_DIR} directory!"$ENDCOLOR | ||
22 | echo "" | ||
23 | |||
24 | sleep 1 | ||
25 | |||
26 | yt-dlp -x --audio-format mp3 --embed-metadata -o $MUSIC_DIR $1 | ||
diff --git a/.bin/esp_upload.sh b/.bin/esp_upload.sh deleted file mode 100755 index 27d8d41..0000000 --- a/.bin/esp_upload.sh +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # rm /tmp/arduino-sketch-*/ -r | ||
4 | ~/.local/bin/arduino-cli cache clean | ||
5 | ~/.local/bin/arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2 | ||
6 | ~/.local/bin/arduino-cli upload -p /dev/ttyUSB0 --fqbn esp8266:esp8266:nodemcuv2 | ||
diff --git a/.bin/file_upload.sh b/.bin/file_upload.sh deleted file mode 100755 index 0ff6c57..0000000 --- a/.bin/file_upload.sh +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | BOLD="\e[1"; | ||
4 | ENDCOLOR="\e[0m"; | ||
5 | Green="32m"; | ||
6 | LightRed="31m"; | ||
7 | |||
8 | echo "" | ||
9 | echo -e $BOLD";"";"$Green" FILE UPLOADER"$ENDCOLOR | ||
10 | echo "" | ||
11 | |||
12 | if ! [ $1 ]; then | ||
13 | echo "" | ||
14 | echo -e $BOLD";"";"$LightRed" Please provide file path!"$ENDCOLOR | ||
15 | echo "" | ||
16 | exit | ||
17 | fi | ||
18 | |||
19 | if [ $1 ]; then | ||
20 | echo -e " Are u sure u want upload this file: "$BOLD";"";"$Green" '$1'"$ENDCOLOR"? [y/N]: " | ||
21 | read -p " " input | ||
22 | echo "" | ||
23 | # read -r -p " " input | ||
24 | case $input in | ||
25 | [yY][eE][sS]|[yY]) | ||
26 | URL=$(curl -s -F "file=@$1" https://0x0.st); | ||
27 | echo -e " URL: "$BOLD";"";"$Green"$URL"$ENDCOLOR; | ||
28 | ;; | ||
29 | [nN][oO]|[nN]) | ||
30 | echo -e $BOLD";"";"$Green" OK"$ENDCOLOR; | ||
31 | ;; | ||
32 | *) | ||
33 | echo -e $BOLD";"";"$LightRed" Invalid input..."$ENDCOLOR; | ||
34 | exit 1 | ||
35 | ;; | ||
36 | esac | ||
37 | echo "" | ||
38 | fi; | ||
diff --git a/.bin/home-reconfigure b/.bin/home-reconfigure deleted file mode 100755 index f3a4e5f..0000000 --- a/.bin/home-reconfigure +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | JD_HOME=1 guix home -L $HOME/dotfiles/guix reconfigure $HOME/dotfiles/guix/jd/desktops/$(hostname).scm | ||
diff --git a/.bin/jd-arduino-cli.Dockerfile b/.bin/jd-arduino-cli.Dockerfile deleted file mode 100644 index cb8eb91..0000000 --- a/.bin/jd-arduino-cli.Dockerfile +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | FROM python:3.12-rc-slim | ||
2 | |||
3 | RUN apt update && apt install -y wget && \ | ||
4 | wget https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_64bit.tar.gz && \ | ||
5 | tar -C /usr/bin/ -xf arduino-cli_nightly-latest_Linux_64bit.tar.gz | ||
6 | |||
7 | RUN mkdir ~/.arduino15 && \ | ||
8 | echo "board_manager:" > ~/.arduino15/arduino-cli.yaml && \ | ||
9 | echo " additional_urls:" >> ~/.arduino15/arduino-cli.yaml && \ | ||
10 | echo " - http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> ~/.arduino15/arduino-cli.yaml | ||
11 | |||
12 | |||
13 | RUN arduino-cli core update-index && \ | ||
14 | arduino-cli core install esp8266:esp8266 | ||
15 | |||
16 | WORKDIR /src \ No newline at end of file | ||
diff --git a/.bin/oath b/.bin/oath deleted file mode 100755 index 7444993..0000000 --- a/.bin/oath +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | if [[ $1 ]]; then | ||
4 | PASS=$(oathtool -b --totp $(pass show "oath/$1")) | ||
5 | printf $PASS | wl-copy | ||
6 | echo "pass: $PASS" | ||
7 | echo "Password should be in your clipboard!" | ||
8 | else | ||
9 | echo "Usage: oath <pass>" | ||
10 | echo "Available pass:" | ||
11 | pass oath | ||
12 | fi | ||
13 | |||
14 | |||
diff --git a/.bin/profile-add-all b/.bin/profile-add-all deleted file mode 100755 index bca4178..0000000 --- a/.bin/profile-add-all +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles | ||
4 | for i in $HOME/.config/guix/manifests/*; do | ||
5 | echo $i | ||
6 | MANIFEST_NAME=$(basename $i .scm) | ||
7 | mkdir -p "$GUIX_EXTRA_PROFILES"/"$MANIFEST_NAME" | ||
8 | guix package --manifest=$i --profile="$GUIX_EXTRA_PROFILES/$MANIFEST_NAME/$MANIFEST_NAME" | ||
9 | done | ||
diff --git a/.bin/stumpish b/.bin/stumpish deleted file mode 100755 index 9e95c0c..0000000 --- a/.bin/stumpish +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Copyright (C) 2007 Jonathan Moore Liles | ||
4 | # | ||
5 | # Maintainer: Jonathan Moore Liles | ||
6 | # | ||
7 | # stumpish is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License as published by | ||
9 | # the Free Software Foundation; either version 2, or (at your option) | ||
10 | # any later version. | ||
11 | # | ||
12 | # stumpish is distributed in the hope that it will be useful, | ||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | # GNU General Public License for more details. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License | ||
18 | # along with this software; see the file COPYING. If not, see | ||
19 | # <http://www.gnu.org/licenses/>. | ||
20 | |||
21 | ### STUMPwm Interactive SHell. | ||
22 | |||
23 | DELAY=0.01 | ||
24 | |||
25 | if ! sleep $DELAY 2>/dev/null >&2 | ||
26 | then | ||
27 | DELAY=1 | ||
28 | fi | ||
29 | |||
30 | # replace -E with -r option for old versions of GNU sed | ||
31 | if ! sed -E 1p /dev/null 2>/dev/null; then | ||
32 | sed() { shift; command sed -r "$@"; } | ||
33 | fi | ||
34 | |||
35 | # parse C-style backslash sequences by default | ||
36 | if [ "$(echo -e foo)" = foo ]; then | ||
37 | echo() { builtin echo -e "$@"; } | ||
38 | fi | ||
39 | |||
40 | wait_result () | ||
41 | { | ||
42 | while true | ||
43 | do | ||
44 | RESULT=$(xprop -root -f STUMPWM_COMMAND_RESULT 8s \ | ||
45 | STUMPWM_COMMAND_RESULT 2>/dev/null | | ||
46 | sed -E 's/\\([[:digit:]]+)/\\0\1/g') | ||
47 | if echo "$RESULT" | grep -v -q 'not found.$' | ||
48 | then | ||
49 | break | ||
50 | fi | ||
51 | |||
52 | sleep $DELAY | ||
53 | done | ||
54 | |||
55 | xprop -root -remove STUMPWM_COMMAND_RESULT | ||
56 | |||
57 | if echo "$RESULT" | grep -q '= $' | ||
58 | then | ||
59 | return 0 | ||
60 | fi | ||
61 | |||
62 | echo "$RESULT" | | ||
63 | sed -E 's/[^"\\n]+"// | ||
64 | /^"[[:space:]]*$/d | ||
65 | s/(^|[^\\])\\n/\1\ | ||
66 | /g | ||
67 | s/\\(["\\n])/\1/g | ||
68 | s/\^([*[:digit:]]+|[Bbn])//g' | ||
69 | } | ||
70 | |||
71 | send_cmd () | ||
72 | { | ||
73 | local cmd="$1" | ||
74 | |||
75 | if [ "$cmd" = "stumpwm-quit" ] | ||
76 | then | ||
77 | cmd=quit | ||
78 | elif [ "$cmd" = "quit" ] | ||
79 | then | ||
80 | exit | ||
81 | fi | ||
82 | |||
83 | xprop -root -f STUMPWM_COMMAND 8s -set STUMPWM_COMMAND "$cmd" | ||
84 | |||
85 | wait_result | ||
86 | } | ||
87 | |||
88 | usage () | ||
89 | { | ||
90 | cat <<EOF | ||
91 | Usage: ${0##*/} [[-e|-r] command [args...]] | ||
92 | |||
93 | StumpIsh is the StumpWM shell. Use it to interact a running StumpWM | ||
94 | instance. When run from a terminal with no arguments, stumpish | ||
95 | accepts commands interactively and prints each result. If standard | ||
96 | input is a pipe, stumpish executes any number of commands and prints | ||
97 | the concatenated results. If the '-e' option and one argument are | ||
98 | given on the command line, stumpish reads any number of lines from | ||
99 | standard input and uses them as the argument to the named command. | ||
100 | Otherwise, if one or more arguments are provided on the command line, | ||
101 | the first is considered the name of the command to execute and the | ||
102 | remainder is concatenated to form the argument. | ||
103 | |||
104 | Example: | ||
105 | echo '(group-windows (current-group))' | ${0##*/} -e eval | ||
106 | EOF | ||
107 | exit 0; | ||
108 | } | ||
109 | |||
110 | warn () | ||
111 | { | ||
112 | { | ||
113 | tput md bold | ||
114 | tput AF setaf 1 | ||
115 | echo 'WARN:\c' | ||
116 | tput me sgr0 | ||
117 | echo " $*" | ||
118 | } >&2 | ||
119 | } | ||
120 | |||
121 | tput () | ||
122 | { | ||
123 | local cap1=$1 cap2=$2 | ||
124 | shift 2 | ||
125 | |||
126 | command tput $cap1 $@ 2>/dev/null || | ||
127 | command tput $cap2 $@ 2>/dev/null | ||
128 | } | ||
129 | |||
130 | READLINE=yes | ||
131 | |||
132 | if [ "x$1" = "x-r" ] | ||
133 | then | ||
134 | READLINE=no | ||
135 | shift 1 | ||
136 | fi | ||
137 | |||
138 | if [ $# -gt 0 ] | ||
139 | then | ||
140 | [ "$1" = "--help" ] && usage | ||
141 | if [ "$1" = "-e" ] | ||
142 | then | ||
143 | if [ $# -ne 2 ] | ||
144 | then | ||
145 | echo "'-e' requires exactly one argument!" | ||
146 | exit | ||
147 | fi | ||
148 | shift 1 | ||
149 | IFS='' | ||
150 | ARGS=$(cat /dev/stdin) | ||
151 | send_cmd "$1 $ARGS" | ||
152 | else | ||
153 | IFS=' ' | ||
154 | send_cmd "$*" | ||
155 | fi | ||
156 | else | ||
157 | if [ -t 0 ] | ||
158 | then | ||
159 | if ! type rlwrap 2>/dev/null >&2 | ||
160 | then | ||
161 | warn rlwrap not found, command completion won\'t work | ||
162 | elif [ $READLINE = yes ] | ||
163 | then | ||
164 | COMMANDS="${TMPDIR:-/tmp}/stumpish.commands.$$" | ||
165 | echo $(send_cmd "commands") | | ||
166 | sed -E 's/[[:space:]]+/\ | ||
167 | /g' | | ||
168 | sort > "$COMMANDS" | ||
169 | trap 'rm -f "$COMMANDS"' exit int term | ||
170 | rlwrap -b '' -f "$COMMANDS" "$0" -r | ||
171 | exit | ||
172 | fi | ||
173 | |||
174 | tput AF setaf 5 | ||
175 | echo Welcome to the STUMPwm Interactive SHell. | ||
176 | tput me sgr0 | ||
177 | echo 'Type \c' | ||
178 | tput AF setaf 2 | ||
179 | echo 'commands\c' | ||
180 | tput me sgr0 | ||
181 | echo \ for a list of commands. | ||
182 | |||
183 | while read -p '> ' REPLY | ||
184 | do | ||
185 | tput md bold | ||
186 | tput AF setaf 2 | ||
187 | send_cmd "$REPLY" | ||
188 | tput me sgr0 | ||
189 | done | ||
190 | else | ||
191 | while read REPLY | ||
192 | do | ||
193 | send_cmd "$REPLY" | ||
194 | done | ||
195 | fi | ||
196 | fi | ||
diff --git a/.bin/system-reconfigure b/.bin/system-reconfigure deleted file mode 100755 index c4c1a05..0000000 --- a/.bin/system-reconfigure +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | sudo -E guix system -L $HOME/dotfiles/guix reconfigure $HOME/dotfiles/guix/jd/desktops/$(hostname).scm \ No newline at end of file | ||
diff --git a/.bin/update.sh b/.bin/update.sh deleted file mode 100755 index e6f9f8d..0000000 --- a/.bin/update.sh +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | sudo emerge --sync | ||
4 | sudo emerge --ask --verbose --update --newuse --deep @world; | ||
diff --git a/.bin/whois-at-hsp b/.bin/whois-at-hsp deleted file mode 100755 index 0cd03f7..0000000 --- a/.bin/whois-at-hsp +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | #!/usr/bin/env -S guix shell guile guile-json -- guile --no-auto-compile -e main -s | ||
2 | -*- scheme -*- | ||
3 | !# | ||
4 | |||
5 | (use-modules (srfi srfi-1) | ||
6 | (ice-9 iconv) | ||
7 | (ice-9 receive) | ||
8 | (web client) | ||
9 | (json)) | ||
10 | |||
11 | (define whois-at-hsp-endpoint "https://whois.at.hsp.sh/api/now") | ||
12 | |||
13 | (define (http-get-serialize-json url) | ||
14 | (receive (response data) (http-request url) | ||
15 | (values (json-string->scm (bytevector->string data "UTF-8")) | ||
16 | response))) | ||
17 | |||
18 | (define (whois-data->users whois-data) | ||
19 | (assoc-ref whois-data "users")) | ||
20 | |||
21 | (define (whois-data->unknown-devices whois-data) | ||
22 | (assoc-ref whois-data "unknown_devices")) | ||
23 | |||
24 | (define (whois-data->head-count whois-data) | ||
25 | (assoc-ref whois-data "headcount")) | ||
26 | |||
27 | (define (whois-data->formated-users whois-data) | ||
28 | (let ((users (vector->list (whois-data->users whois-data)))) | ||
29 | (if (> (length users) 0) | ||
30 | (fold-right | ||
31 | (lambda (a b) (string-append a " " b)) | ||
32 | "" | ||
33 | users) | ||
34 | "No visible users!"))) | ||
35 | |||
36 | (define (whois-data->summary whois-data) | ||
37 | (string-append | ||
38 | "Unknown devices: " | ||
39 | (number->string (whois-data->unknown-devices whois-data)) | ||
40 | "\nUsers: [" (number->string (whois-data->head-count whois-data)) "] " | ||
41 | (whois-data->formated-users whois-data))) | ||
42 | |||
43 | (define (notify data) | ||
44 | (system* "notify-send" | ||
45 | "WHOIS AT HSP" | ||
46 | (whois-data->summary data))) | ||
47 | |||
48 | (define (command-line-option? option args) | ||
49 | (> (length (or (member option args) | ||
50 | '())) | ||
51 | 0)) | ||
52 | |||
53 | (define-syntax-rule (command-line-args-handle args default ((option ...) body ...) ...) | ||
54 | (let ((option? (lambda (o) (command-line-option? o args))) | ||
55 | (something-executed? #f)) | ||
56 | (when (or (option? option) ...) | ||
57 | (set! something-executed? #t) | ||
58 | body ...) ... | ||
59 | (when (not something-executed?) | ||
60 | default))) | ||
61 | |||
62 | (define (main args) | ||
63 | (let ((whois-data (http-get-serialize-json whois-at-hsp-endpoint))) | ||
64 | (command-line-args-handle args | ||
65 | (begin (display (whois-data->summary whois-data)) | ||
66 | (newline)) | ||
67 | (("-h" "--help") | ||
68 | (display (string-append "-h, --help Help message\n" | ||
69 | "-n, --notify Notification massage with whois information.\n" | ||
70 | "-u Get users\n" | ||
71 | "-H Get head count\n" | ||
72 | "-U Get unknown devices\n"))) | ||
73 | (("-n" "--notify") | ||
74 | (notify whois-data)) | ||
75 | (("-u") | ||
76 | (display (whois-data->formated-users whois-data)) | ||
77 | (newline)) | ||
78 | (("-H") | ||
79 | (display (whois-data->head-count whois-data)) | ||
80 | (newline)) | ||
81 | (("-U") | ||
82 | (display (whois-data->unknown-devices whois-data)) | ||
83 | (newline))))) | ||
84 | |||