summaryrefslogtreecommitdiffstats
path: root/files/.bin
diff options
context:
space:
mode:
Diffstat (limited to 'files/.bin')
-rwxr-xr-xfiles/.bin/arduino-cli14
-rwxr-xr-xfiles/.bin/chiaki21
-rwxr-xr-xfiles/.bin/clean.sh3
-rwxr-xr-xfiles/.bin/download_music.sh26
-rwxr-xr-xfiles/.bin/esp_upload.sh6
-rwxr-xr-xfiles/.bin/file_upload.sh38
-rwxr-xr-xfiles/.bin/guix-container8
-rwxr-xr-xfiles/.bin/home-reconfigure3
-rw-r--r--files/.bin/jd-arduino-cli.Dockerfile16
-rwxr-xr-xfiles/.bin/mount-nas-abaks1
-rwxr-xr-xfiles/.bin/oath14
-rwxr-xr-xfiles/.bin/profile-add-all9
-rwxr-xr-xfiles/.bin/stumpish196
-rwxr-xr-xfiles/.bin/system-reconfigure3
-rwxr-xr-xfiles/.bin/update.sh4
-rwxr-xr-xfiles/.bin/whois-at-hsp84
16 files changed, 446 insertions, 0 deletions
diff --git a/files/.bin/arduino-cli b/files/.bin/arduino-cli
new file mode 100755
index 0000000..7c0d41a
--- /dev/null
+++ b/files/.bin/arduino-cli
@@ -0,0 +1,14 @@
1#!/bin/sh
2
3SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4
5if [[ $(docker images | grep jd-arduino-cli | wc -l) -eq 0 ]]
6then
7 docker build -f "$SCRIPT_DIR/jd-arduino-cli.Dockerfile" -t jd-arduino-cli .
8fi
9
10docker 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/files/.bin/chiaki b/files/.bin/chiaki
new file mode 100755
index 0000000..5fa6547
--- /dev/null
+++ b/files/.bin/chiaki
@@ -0,0 +1,21 @@
1#!/bin/sh
2
3CHIAKI_SHELL=/tmp/.chiaki.nix
4
5cat <<EOF > $CHIAKI_SHELL
6let
7 nixgl = import (fetchTarball https://github.com/guibou/nixGL/archive/main.tar.gz) { };
8in
9{ nixpkgs ? import <nixpkgs> {} }:
10with nixpkgs; mkShell {
11 buildInputs = [
12 chiaki
13 nixgl.auto.nixGLDefault
14 ];
15 shellHook = ''
16 nixGL chiaki && exit;
17 '';
18}
19EOF
20
21nix-shell $CHIAKI_SHELL
diff --git a/files/.bin/clean.sh b/files/.bin/clean.sh
new file mode 100755
index 0000000..3e6bbfd
--- /dev/null
+++ b/files/.bin/clean.sh
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3sudo emerge --ask --depclean;
diff --git a/files/.bin/download_music.sh b/files/.bin/download_music.sh
new file mode 100755
index 0000000..e3a3601
--- /dev/null
+++ b/files/.bin/download_music.sh
@@ -0,0 +1,26 @@
1#!/bin/sh
2
3BOLD="\e[1";
4ENDCOLOR="\e[0m";
5Green="32";
6LightRed="31";
7
8if ! [ $1 ]; then
9 echo ""
10 echo -e $BOLD";"";"$LightRed"m Please provide music url!"$ENDCOLOR
11 echo ""
12 exit
13fi
14
15MUSIC_DIR="~/Documents/Music/%(artist)s/%(album)s/%(title)s-%(id)s.%(ext)s"
16if [ $2 ]; then
17 MUSIC_DIR="${a}/%(artist)s/%(album)s/%(title)s-%(id)s.%(ext)s"
18fi
19
20echo ""
21echo -e $BOLD";"";"$Green"m Music will download to ${MUSIC_DIR} directory!"$ENDCOLOR
22echo ""
23
24sleep 1
25
26yt-dlp -x --audio-format mp3 --embed-metadata -o $MUSIC_DIR $1
diff --git a/files/.bin/esp_upload.sh b/files/.bin/esp_upload.sh
new file mode 100755
index 0000000..27d8d41
--- /dev/null
+++ b/files/.bin/esp_upload.sh
@@ -0,0 +1,6 @@
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/files/.bin/file_upload.sh b/files/.bin/file_upload.sh
new file mode 100755
index 0000000..0ff6c57
--- /dev/null
+++ b/files/.bin/file_upload.sh
@@ -0,0 +1,38 @@
1#!/bin/sh
2
3BOLD="\e[1";
4ENDCOLOR="\e[0m";
5Green="32m";
6LightRed="31m";
7
8echo ""
9echo -e $BOLD";"";"$Green" FILE UPLOADER"$ENDCOLOR
10echo ""
11
12if ! [ $1 ]; then
13 echo ""
14 echo -e $BOLD";"";"$LightRed" Please provide file path!"$ENDCOLOR
15 echo ""
16 exit
17fi
18
19if [ $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 ""
38fi;
diff --git a/files/.bin/guix-container b/files/.bin/guix-container
new file mode 100755
index 0000000..162eda0
--- /dev/null
+++ b/files/.bin/guix-container
@@ -0,0 +1,8 @@
1#!/bin/sh
2
3guix shell -C -F -N \
4 -E XDG_RUNTIME_DIR=/tmp \
5 -E WAYLAND_DISPLAY \
6 -E DISPLAY \
7 --share=$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY=/tmp/$WAYLAND_DISPLAY \
8 $@ coreutils
diff --git a/files/.bin/home-reconfigure b/files/.bin/home-reconfigure
new file mode 100755
index 0000000..f3a4e5f
--- /dev/null
+++ b/files/.bin/home-reconfigure
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3JD_HOME=1 guix home -L $HOME/dotfiles/guix reconfigure $HOME/dotfiles/guix/jd/desktops/$(hostname).scm
diff --git a/files/.bin/jd-arduino-cli.Dockerfile b/files/.bin/jd-arduino-cli.Dockerfile
new file mode 100644
index 0000000..cb8eb91
--- /dev/null
+++ b/files/.bin/jd-arduino-cli.Dockerfile
@@ -0,0 +1,16 @@
1FROM python:3.12-rc-slim
2
3RUN 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
7RUN 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
13RUN arduino-cli core update-index && \
14 arduino-cli core install esp8266:esp8266
15
16WORKDIR /src \ No newline at end of file
diff --git a/files/.bin/mount-nas-abaks b/files/.bin/mount-nas-abaks
new file mode 100755
index 0000000..6c14817
--- /dev/null
+++ b/files/.bin/mount-nas-abaks
@@ -0,0 +1 @@
sudo mount -t cifs -o vers=2.0,username=kdlugosz,password=$(pass nas/abaks/kdlugosz) //195.74.91.28/kdlugosz /mnt \ No newline at end of file
diff --git a/files/.bin/oath b/files/.bin/oath
new file mode 100755
index 0000000..7444993
--- /dev/null
+++ b/files/.bin/oath
@@ -0,0 +1,14 @@
1#!/bin/sh
2
3if [[ $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!"
8else
9 echo "Usage: oath <pass>"
10 echo "Available pass:"
11 pass oath
12fi
13
14
diff --git a/files/.bin/profile-add-all b/files/.bin/profile-add-all
new file mode 100755
index 0000000..bca4178
--- /dev/null
+++ b/files/.bin/profile-add-all
@@ -0,0 +1,9 @@
1#!/bin/sh
2
3GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
4for 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"
9done
diff --git a/files/.bin/stumpish b/files/.bin/stumpish
new file mode 100755
index 0000000..9e95c0c
--- /dev/null
+++ b/files/.bin/stumpish
@@ -0,0 +1,196 @@
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
23DELAY=0.01
24
25if ! sleep $DELAY 2>/dev/null >&2
26then
27 DELAY=1
28fi
29
30# replace -E with -r option for old versions of GNU sed
31if ! sed -E 1p /dev/null 2>/dev/null; then
32 sed() { shift; command sed -r "$@"; }
33fi
34
35# parse C-style backslash sequences by default
36if [ "$(echo -e foo)" = foo ]; then
37 echo() { builtin echo -e "$@"; }
38fi
39
40wait_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
71send_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
88usage ()
89{
90 cat <<EOF
91Usage: ${0##*/} [[-e|-r] command [args...]]
92
93StumpIsh is the StumpWM shell. Use it to interact a running StumpWM
94instance. When run from a terminal with no arguments, stumpish
95accepts commands interactively and prints each result. If standard
96input is a pipe, stumpish executes any number of commands and prints
97the concatenated results. If the '-e' option and one argument are
98given on the command line, stumpish reads any number of lines from
99standard input and uses them as the argument to the named command.
100Otherwise, if one or more arguments are provided on the command line,
101the first is considered the name of the command to execute and the
102remainder is concatenated to form the argument.
103
104Example:
105 echo '(group-windows (current-group))' | ${0##*/} -e eval
106EOF
107 exit 0;
108}
109
110warn ()
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
121tput ()
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
130READLINE=yes
131
132if [ "x$1" = "x-r" ]
133then
134 READLINE=no
135 shift 1
136fi
137
138if [ $# -gt 0 ]
139then
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
156else
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
196fi
diff --git a/files/.bin/system-reconfigure b/files/.bin/system-reconfigure
new file mode 100755
index 0000000..c4c1a05
--- /dev/null
+++ b/files/.bin/system-reconfigure
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3sudo -E guix system -L $HOME/dotfiles/guix reconfigure $HOME/dotfiles/guix/jd/desktops/$(hostname).scm \ No newline at end of file
diff --git a/files/.bin/update.sh b/files/.bin/update.sh
new file mode 100755
index 0000000..e6f9f8d
--- /dev/null
+++ b/files/.bin/update.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2
3sudo emerge --sync
4sudo emerge --ask --verbose --update --newuse --deep @world;
diff --git a/files/.bin/whois-at-hsp b/files/.bin/whois-at-hsp
new file mode 100755
index 0000000..982a90e
--- /dev/null
+++ b/files/.bin/whois-at-hsp
@@ -0,0 +1,84 @@
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 (cond ((or (option? option) ...) body ...) ...
56 (#t default))))
57
58;; (command-line-args-handle '("a" "--help")
59;; 0
60;; (("-h" "--help") "dupa"))
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