From e9c14236067436b12dc5fe6ad95fd73b2e6c4eb0 Mon Sep 17 00:00:00 2001 From: Hassan Afify Date: Tue, 10 Mar 2020 21:15:34 +0300 Subject: [PATCH] [feat] scripts use posix sh, gen_pass - tmp remove patch dir - use posix instead of bash - gen_pass: change all password in .password-store create txt file with old passwords open firefox for each url --- .gitconfig | 18 +-- .scripts/config_ssh.sh | 10 +- .scripts/create_diff_git.sh | 21 ++-- .scripts/gen_pass.sh | 22 ++++ .scripts/git_remote.sh | 5 + .scripts/patches/dwmc.diff | 58 ---------- .scripts/patches/dwmconfig.diff | 242 ---------------------------------------- .scripts/patches/grub.sh | 0 .scripts/patches/gruvbox.diff | 24 ---- .scripts/patches/gruvbox_vim.sh | 8 -- .scripts/patches/nvidia.sh | 0 .scripts/patches/suckless.sh | 11 -- .scripts/patches/xinput.sh | 0 .scripts/scan_network.sh | 9 +- .scripts/unmount_drives.sh | 29 +++-- .scripts/xbps_base.txt | 14 ++- .vim/syntax/log.vim | 2 + 17 files changed, 84 insertions(+), 389 deletions(-) create mode 100644 .scripts/gen_pass.sh create mode 100644 .scripts/git_remote.sh delete mode 100644 .scripts/patches/dwmc.diff delete mode 100644 .scripts/patches/dwmconfig.diff delete mode 100644 .scripts/patches/grub.sh delete mode 100644 .scripts/patches/gruvbox.diff delete mode 100644 .scripts/patches/gruvbox_vim.sh delete mode 100644 .scripts/patches/nvidia.sh delete mode 100644 .scripts/patches/suckless.sh delete mode 100644 .scripts/patches/xinput.sh create mode 100644 .vim/syntax/log.vim diff --git a/.gitconfig b/.gitconfig index 545a7d4..3b5cf8e 100644 --- a/.gitconfig +++ b/.gitconfig @@ -22,7 +22,6 @@ [diff] tool = vimdiff - noprefix = true algorithm = patience renames = copies @@ -38,7 +37,7 @@ followTags = true [github] - user = Afify + user = afify [log] date = local @@ -50,9 +49,6 @@ [hub] protocol = https -# [url "https://"] -# insteadOf = git:// - [alias] st = status s = status --short --branch @@ -68,12 +64,14 @@ # Push p = push github master - pushall = !git remote | xargs -L1 git push --all + pushall = !git remote | xargs -L1 git push master show-unpushed-branches = log --branches --not --remotes --simplify-by-decoration --decorate --oneline # show-unpushed-commits = # Diff d = difftool HEAD + create-diff = !sh ~/.scripts/create_diff_git.sh + apply-diff = !result=$(ls *.diff | dmenu -p 'select diff file' -l 10) && git apply $result # df = difftool master..otherbr -- filename # Commit @@ -98,6 +96,7 @@ # Log l = log --all --pretty=format:"%C(#0080ff)%h\\ \\%C(#c0d6de)%s\\%C(#17b062)%d" + lc = log --pretty=format:"%C(#0080ff)%h\\ \\%C(#c0d6de)%s\\%C(#17b062)%d" lgpg = log --all --pretty=format:"%C(#0080ff)%h\\ %C(#cd9a00)%G?\\ \\%C(#c0d6de)%s\\%C(#17b062)%d" ll = log --all --graph --pretty=format:"%C(#0080ff)%h\\ \\%C(#c0d6de)%s\\%C(#17b062)%d" lo = log --all --pretty=format:"%C(#cd9a00)%h\\%C(#0080ff)\\ <%an>\\ %C(#17b062)(%cr)%d\\ \\%C(#c0d6de)%s" @@ -145,6 +144,7 @@ # interactive staging addi = add --interactive -# diff - create-diff = !sh ~/.scripts/create_diff_git.sh - apply-diff = !result=$(ls *.diff | dmenu -p 'select diff file' -l 10) && git apply $result +# stash +# git stash save +# git stash pop + diff --git a/.scripts/config_ssh.sh b/.scripts/config_ssh.sh index d2ba247..b456c43 100644 --- a/.scripts/config_ssh.sh +++ b/.scripts/config_ssh.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #sshd sudo sh -c "echo \" @@ -6,15 +6,17 @@ KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256 PasswordAuthentication no ChallengeResponseAuthentication no PubkeyAuthentication yes +AuthorizedKeysFile .ssh/authorized_keys PermitRootLogin no AllowGroups ssh-user Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com\" >> /etc/ssh/sshd_config; groupadd ssh-user; usermod -a -G ssh-user $USER" #ssh -exists=$(grep "^Host \*" $HOME/.ssh/config) -if [[ ! $exists ]]; then -echo -e "\nHost * +exists=$(grep "^Host \*" "$HOME/.ssh/config") +if [ ! "$exists" ]; then +echo " +Host * KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256 PasswordAuthentication no ChallengeResponseAuthentication no diff --git a/.scripts/create_diff_git.sh b/.scripts/create_diff_git.sh index dab5c15..7787199 100755 --- a/.scripts/create_diff_git.sh +++ b/.scripts/create_diff_git.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Description : create diff file from 2 commits @@ -11,20 +11,21 @@ # diff -r -x *.o -x *.so -x *.git dir1 dir2 -old_commit=$(git log --pretty=format:'%h %s' |\ +old_commit=$(git log --all --pretty=format:'%h %s %d' |\ dmenu -p 'old commmit' -l 10 | awk '{print $1}') -if [[ "$old_commit" ]]; then - new_commit=$(git log --pretty=format:'%h %s' |\ +if [ "$old_commit" ]; then + new_commit=$(git log --all --pretty=format:'%h %s' |\ dmenu -p 'new commmit' -l 10 | awk '{print $1}') - if [[ "$new_commit" ]]; then + if [ "$new_commit" ]; then +# TODO file_name=$(ls -p | grep -v /| dmenu -p 'select file' -l 10) - if [[ "$file_name" ]]; then - output_file=$file_name.diff - git diff "$old_commit" "$new_commit" -- "$file_name" > "$output_file" + if [ "$file_name" ]; then + output_file="$old_commit"_"$new_commit"_"$file_name".diff + git diff "$old_commit" "$new_commit" -- "$file_name" > "$output_file" && echo "create diff for $file_name." else - output_file="$old_commit\-$new_commit".diff - git diff "$old_commit" "$new_commit" > "$output_file" + output_file="$old_commit"_"$new_commit".diff + git diff "$old_commit" "$new_commit" > "$output_file" && echo "create diff all dir." fi fi fi diff --git a/.scripts/gen_pass.sh b/.scripts/gen_pass.sh new file mode 100644 index 0000000..0b75ea7 --- /dev/null +++ b/.scripts/gen_pass.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +change(){ + pass_dir="$HOME/.password-store" + backup_dir="$HOME/pass_bk" + [ -d "$backup_dir" ] || mkdir "$backup_dir" + all=$(find "$pass_dir" -type f -iname "*.gpg" -printf '%f\n' | sed -n 's/\.gpg$//p') + all_url=$(echo "$all" | awk -F: '{print $1}') + + for i in $all; do + pass "$i" >> "$backup_dir/$i.txt" + pass generate -f "$i" 25 + done + + firefox $all_url +} + +case $1 in + reg) pass generate --no-symbols -f "$2" 20;; + change) change;; + *) echo "(reg | change)" +esac diff --git a/.scripts/git_remote.sh b/.scripts/git_remote.sh new file mode 100644 index 0000000..b4cec70 --- /dev/null +++ b/.scripts/git_remote.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +exec surf https://github.com/ & +exec surf https://repo.or.cz/projlist.cgi?name=a15881596efea75a1c46081fff8e7656 & +# exec surf repo.or.cz/azan.git & diff --git a/.scripts/patches/dwmc.diff b/.scripts/patches/dwmc.diff deleted file mode 100644 index d77fe22..0000000 --- a/.scripts/patches/dwmc.diff +++ /dev/null @@ -1,58 +0,0 @@ ---- dwm/dwm.c 2019-10-23 22:00:05.157679567 +0300 -+++ /mnt/data/dev/suckless/dwm-6.2/dwm.c 2019-10-23 19:34:18.724418081 +0300 -@@ -59,7 +59,10 @@ - - /* enums */ - enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ --enum { SchemeNorm, SchemeSel }; /* color schemes */ -+enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent, -+SchemeCol5,SchemeCol6,SchemeCol7,SchemeCol8,SchemeCol9, -+SchemeCol10,SchemeCol11,SchemeCol12,SchemeCol13 -+}; /* color schemes */ - enum { NetSupported, NetWMName, NetWMState, NetWMCheck, - NetWMFullscreen, NetActiveWindow, NetWMWindowType, - NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ -@@ -699,13 +702,54 @@ - int boxs = drw->fonts->h / 9; - int boxw = drw->fonts->h / 6 + 2; - unsigned int i, occ = 0, urg = 0; -+ char *ts = stext; -+ char *tp = stext; -+ int tx = 0; -+ char ctmp; - Client *c; - -+ /* correction for colours */ -+ int correct = 0; -+ char *xcape = malloc (sizeof (char) * 128); -+ memset(xcape,0,sizeof (char) * 128); -+ for ( ; *ts != '\0' ; ts++) { -+ if (*ts <= LENGTH(colors)) { -+ sprintf(xcape,"%c",*ts); -+ correct += TEXTW(xcape) - lrpad; -+ } -+ } -+ free(xcape); -+ ts = stext; -+ - /* draw status first so it can be overdrawn by tags later */ - if (m == selmon) { /* status is only drawn on selected monitor */ - drw_setscheme(drw, scheme[SchemeNorm]); -- sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ -- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); -+ sw = TEXTW(stext) - lrpad + 2 - correct; /* 2px right padding */ -+ while (1) { -+ if ((unsigned int)*ts > LENGTH(colors)) {ts++; continue ;} -+ ctmp = *ts; -+ *ts = '\0'; -+ -+ drw_text(drw, m->ww - sw + tx, 0, sw - tx, bh, 0, tp, 0); -+ tx += TEXTW(tp) - lrpad; -+ if (ctmp == '\0') { break; } -+ drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]); -+ *ts = ctmp; -+ tp = ++ts; -+ } - } - - for (c = m->clients; c; c = c->next) { diff --git a/.scripts/patches/dwmconfig.diff b/.scripts/patches/dwmconfig.diff deleted file mode 100644 index 0867f2a..0000000 --- a/.scripts/patches/dwmconfig.diff +++ /dev/null @@ -1,242 +0,0 @@ ---- dwm/config.def.h 2019-10-23 22:00:05.157679567 +0300 -+++ /mnt/data/dev/suckless/dwm-6.2/config.def.h 2019-10-23 20:53:08.591045377 +0300 -@@ -5,40 +5,81 @@ - static const unsigned int snap = 32; /* snap pixel */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ --static const char *fonts[] = { "monospace:size=10" }; --static const char dmenufont[] = "monospace:size=10"; -+static const char *fonts[] = { "xos4 Terminus:pixelsize=22" }; -+static const char dmenufont[] = "xos4 Terminus:pixelsize=22"; - static const char col_gray1[] = "#222222"; - static const char col_gray2[] = "#444444"; - static const char col_gray3[] = "#bbbbbb"; - static const char col_gray4[] = "#eeeeee"; - static const char col_cyan[] = "#005577"; -+static const char col_black[] = "#000000"; -+static const char col_red[] = "#ff0000"; -+static const char col_yellow[] = "#ffff00"; -+static const char col_white[] = "#ffffff"; -+static const char col_green0[] = "#98971a"; -+static const char col_green1[] = "#b8bb26"; -+static const char col_yellow0[] = "#d79921"; -+static const char col_yellow1[] = "#fabd2f"; -+static const char col_blue0[] = "#458588"; -+static const char col_blue1[] = "#83a598"; -+static const char col_purple0[] = "#b16286"; -+static const char col_purple1[] = "#d3869b"; -+static const char col_aqua0[] = "#689d6a"; -+static const char col_aqua1[] = "#8ec07c"; -+static const char col_orange0[] = "#d65d0e"; -+static const char col_orange1[] = "#fe8019"; -+static const char col_violet[] = "#6a006a"; -+static const char col_ng1[] = "#504945"; -+static const char col_ng2[] = "#665c54"; -+static const char col_ng3[] = "#7c6f64"; -+static const char col_ng4[] = "#928374"; -+ - static const char *colors[][3] = { -- /* fg bg border */ -- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, -- [SchemeSel] = { col_gray4, col_cyan, col_cyan }, -+ /* fg bg border */ -+ [SchemeNorm] = { col_ng1, col_black, col_gray2 }, -+ [SchemeSel] = { col_orange0, col_black, col_green1 }, -+ [SchemeWarn] = { col_black, col_yellow, col_red }, -+ [SchemeUrgent]= { col_white, col_red, col_red }, -+ -+ [SchemeCol5]= { col_cyan, col_black, col_red }, -+ [SchemeCol6]= { col_violet, col_black, col_red }, -+ [SchemeCol7]= { col_green1, col_black, col_red }, -+ [SchemeCol8]= { col_ng1, col_black, col_red }, -+ -+ [SchemeCol9]= { col_aqua0, col_black, col_red }, -+ [SchemeCol10]= { col_orange0,col_black, col_red }, -+ [SchemeCol11]= { col_violet, col_black, col_red }, -+ [SchemeCol12]= { col_red, col_black, col_red }, -+ [SchemeCol13]= { col_yellow, col_black, col_red }, - }; - - /* tagging */ --static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; -+static const char *tags[] = { "", "", "", "", "", "", "", "", "", "", "", "爵" }; - - static const Rule rules[] = { - /* xprop(1): -- * WM_CLASS(STRING) = instance, class -- * WM_NAME(STRING) = title -- */ -+ * WM_CLASS(STRING) = instance, class -+ * WM_NAME(STRING) = title -+ */ - /* class instance title tags mask isfloating monitor */ -- { "Gimp", NULL, NULL, 0, 1, -1 }, -- { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, -+ { "firefox", NULL, NULL, 1 << 11, 0, -1 }, -+ { "st", NULL, "neomutt", 1 << 10, 0, -1 }, -+ { "st", NULL, "newsboat", 1 << 9, 0, -1 }, -+ { "Uget", NULL, NULL, 1 << 6, 0, -1 }, -+ { "Transmission", NULL, NULL, 1 << 6, 0, -1 }, - }; - - /* layout(s) */ - static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ - static const int nmaster = 1; /* number of clients in master area */ --static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ -+static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ - - static const Layout layouts[] = { - /* symbol arrange function */ -- { "[]=", tile }, /* first entry is default */ -+ { "[]", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, - }; -@@ -55,35 +96,122 @@ - #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } - - /* commands */ -+ -+// Applications - static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ --static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -+static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_orange0, "-sf", col_black, NULL }; -+// static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray4, "-nf", col_newgray0, "-sb", col_orange0, "-sf", col_black, NULL }; - static const char *termcmd[] = { "st", NULL }; - -+ -+static const char *vifm[] = { "st", "/home/hassan/.config/vifm/scripts/vifmrun", NULL }; -+static const char *calcurse[] = { "st", "calcurse", "-D", "/mnt/data/calcurse", NULL}; -+static const char *htop[] = { "st", "htop", NULL }; -+static const char *neomutt[] = { "st", "neomutt", NULL }; -+static const char *newsboat[] = { "st", "newsboat", NULL }; -+ -+// Disks -+static const char *mount_drive[] = { "/home/hassan/.scripts/mount_drives.sh", NULL }; -+static const char *unmount_drive[] = { "/home/hassan/.scripts/unmount_drives.sh", NULL }; -+static const char *notify_disks[] = { "/home/hassan/.scripts/notify_disks.sh", NULL }; -+ -+// Connect bluetooth devices -+static const char *connect_bluetooth[] = { "/home/hassan/.scripts/bluetooth_connect.sh", NULL }; -+static const char *connect_bluetooth_force[] = { "/home/hassan/.scripts/bluetooth_connect.sh", "force", NULL }; -+static const char *call_bluetooth[] = { "/home/hassan/.scripts/bluetooth_call.sh", NULL }; -+ -+// Music & Audio -+static const char *play_music[] = { "/home/hassan/.scripts/play_music.sh", NULL }; -+static const char *play_pause[] = { "playerctl", "play-pause", NULL }; -+static const char *next_song[] = { "playerctl", "next", NULL }; -+static const char *prev_song[] = { "playerctl", "previous", NULL }; -+static const char *volume_up[] = { "pactl", "set-sink-volume", "0", "+5%", NULL }; -+static const char *volume_down[] = { "pactl", "set-sink-volume", "0", "-5%", NULL }; -+static const char *mute[] = { "pactl", "set-sink-mute", "0", "toggle", NULL }; -+ -+// Network -+static const char *network_manager_cli[] = { "st", "nmtui", NULL }; -+static const char *notify_network[] = { "/home/hassan/.scripts/notify_network.sh", NULL }; -+ -+// Brightness -+static const char *bright_dec[] = { "xbacklight", "-dec", "10", NULL }; -+static const char *bright_inc[] = { "xbacklight", "-inc", "10", NULL }; -+static const char *bright_max[] = { "xbacklight", "-set", "100", NULL }; -+static const char *bright_min[] = { "xbacklight", "-set", "0", NULL }; -+ -+// Lock & Update -+static const char *lock[] = { "/home/hassan/.scripts/lock.sh", NULL }; -+static const char *update[] = { "/home/hassan/.scripts/update.sh", NULL }; -+ -+// Dmenu -+static const char *run_my_scripts[] = { "/home/hassan/.scripts/list_scripts.sh", NULL }; -+static const char *dmenu_internet[] = { "/home/hassan/.scripts/dmenu_internet.sh", NULL }; -+static const char *passmenu[] = { "passmenu", NULL }; -+ -+// Github -+static const char *github_traffic[] = { "/home/hassan/.scripts/github_traffic.sh", NULL }; -+ -+#include "movestack.c" - static Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, -- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, -+ { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_d, incnmaster, {.i = -1 } }, -- { MODKEY, XK_h, setmfact, {.f = -0.05} }, -- { MODKEY, XK_l, setmfact, {.f = +0.05} }, -- { MODKEY, XK_Return, zoom, {0} }, -+ { MODKEY, XK_h, setmfact, {.f = -0.01} }, -+ { MODKEY, XK_l, setmfact, {.f = +0.01} }, -+ { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, -+ { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, -+ { MODKEY|ShiftMask, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, -- { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, -- { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, -- { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, -- { MODKEY, XK_space, setlayout, {0} }, -- { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, -+// { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, -+// { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, -+// { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, -+// { MODKEY, XK_space, setlayout, {0} }, -+// { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, -+ -+ { MODKEY, XK_q, killclient, {0} }, -+ { MODKEY|Mod4Mask, XK_v, spawn, {.v = vifm } }, -+ { MODKEY|Mod4Mask, XK_c, spawn, {.v = calcurse } }, -+ { MODKEY|Mod4Mask, XK_h, spawn, {.v = htop } }, -+ { MODKEY, XK_n, spawn, {.v = newsboat} }, -+ { MODKEY|Mod4Mask, XK_m, spawn, {.v = mount_drive } }, -+ { MODKEY|ShiftMask|Mod4Mask, XK_m, spawn, {.v = unmount_drive } }, -+ { MODKEY|Mod4Mask, XK_d, spawn, {.v = notify_disks} }, -+ { MODKEY|Mod4Mask, XK_b, spawn, {.v = connect_bluetooth } }, -+ { MODKEY|ShiftMask|Mod4Mask, XK_b, spawn, {.v = connect_bluetooth_force } }, -+ { MODKEY|ControlMask|Mod4Mask, XK_b, spawn, {.v = call_bluetooth } }, -+ { MODKEY|Mod4Mask, XK_p, spawn, {.v = play_music } }, -+ { 0, XK_F7, spawn, {.v = play_pause } }, -+ { 0, XK_F8, spawn, {.v = prev_song} }, -+ { 0, XK_F9, spawn, {.v = next_song} }, -+ { 0, XK_F10, spawn, {.v = mute} }, -+ { 0, XK_F11, spawn, {.v = volume_down} }, -+ { 0, XK_F12, spawn, {.v = volume_up} }, -+ { MODKEY|Mod4Mask, XK_n, spawn, {.v = notify_network} }, -+ { MODKEY|Mod4Mask|ShiftMask, XK_n, spawn, {.v = network_manager_cli} }, -+ { MODKEY|Mod4Mask, XK_l, spawn, {.v = lock} }, -+ { MODKEY|Mod4Mask, XK_u, spawn, {.v = update} }, -+ { 0, XK_F1, spawn, {.v = bright_dec} }, -+ { 0, XK_F2, spawn, {.v = bright_inc} }, -+ { ShiftMask, XK_F1, spawn, {.v = bright_min} }, -+ { ShiftMask, XK_F2, spawn, {.v = bright_max} }, -+ { MODKEY, XK_s, spawn, {.v = dmenu_internet} }, -+ { MODKEY|ShiftMask, XK_s, spawn, {.v = run_my_scripts} }, -+ { MODKEY, XK_w, spawn, {.v = passmenu} }, -+ { MODKEY, XK_m, spawn, {.v = neomutt} }, -+ { MODKEY|Mod4Mask, XK_g, spawn, {.v = github_traffic} }, -+ - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) -@@ -93,6 +221,9 @@ - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) -+ TAGKEYS( XK_0, 9) -+ TAGKEYS( XK_minus, 10) -+ TAGKEYS( XK_equal, 11) - { MODKEY|ShiftMask, XK_q, quit, {0} }, - }; - -@@ -112,4 +243,3 @@ - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, - }; -- diff --git a/.scripts/patches/grub.sh b/.scripts/patches/grub.sh deleted file mode 100644 index e69de29..0000000 diff --git a/.scripts/patches/gruvbox.diff b/.scripts/patches/gruvbox.diff deleted file mode 100644 index 961527c..0000000 --- a/.scripts/patches/gruvbox.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- gruvbox.vim 2019-10-19 17:58:12.786728795 +0300 -+++ gruvbox.vim 2019-10-15 19:01:24.996712860 +0300 -@@ -427,6 +427,7 @@ - call s:HL('GruvboxFg3', s:fg3) - call s:HL('GruvboxFg4', s:fg4) - call s:HL('GruvboxGray', s:gray) -+call s:HL('GruvboxGrayBold', s:gray, s:none, s:bold) - call s:HL('GruvboxBg0', s:bg0) - call s:HL('GruvboxBg1', s:bg1) - call s:HL('GruvboxBg2', s:bg2) -@@ -999,7 +1000,14 @@ - " C: {{{ - - hi! link cOperator GruvboxPurple --hi! link cStructure GruvboxOrange -+hi! link cStructure GruvboxOrangeBold -+hi! link cFunction GruvboxGrayBold -+hi! link cIdentifier GruvboxPurpleBold -+" hi! link cDefine GruvboxRedBold -+" hi! link cBraces GruvboxYellowSign -+" hi! link cDelimiter GruvboxRedSign - - " }}} - " Python: {{{ diff --git a/.scripts/patches/gruvbox_vim.sh b/.scripts/patches/gruvbox_vim.sh deleted file mode 100644 index 6c0937a..0000000 --- a/.scripts/patches/gruvbox_vim.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -# patch gruvbox -patch_dir="/home/hassan/.scripts/patches" -gruv_default="$HOME/.vim/plugged/gruvbox/colors/gruvbox.vim" -mydiff="$patch_dir/gruvbox.diff" - -patch $gruv_default < $mydiff diff --git a/.scripts/patches/nvidia.sh b/.scripts/patches/nvidia.sh deleted file mode 100644 index e69de29..0000000 diff --git a/.scripts/patches/suckless.sh b/.scripts/patches/suckless.sh deleted file mode 100644 index e7c0e87..0000000 --- a/.scripts/patches/suckless.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -# patch dwm - -# patch st - -# patch dmenu - -# patch sent - -# patch surf diff --git a/.scripts/patches/xinput.sh b/.scripts/patches/xinput.sh deleted file mode 100644 index e69de29..0000000 diff --git a/.scripts/scan_network.sh b/.scripts/scan_network.sh index 53fc117..f6a0678 100644 --- a/.scripts/scan_network.sh +++ b/.scripts/scan_network.sh @@ -1,10 +1,11 @@ -#!/usr/bin/env bash +#!/bin/sh cn=$(bash ~/.scripts/network ips | awk -F "." '{print $1"."$2"."$3}') count=$(echo "$cn" | wc -l) -if [[ $count -gt 1 ]]; then - net_ip=$(echo -e "$cn" | dmenu -l 10 -p "Select network: ") +if [ "$count" -gt 0 ]; then + net_ip=$(echo "$cn" | dmenu -l 10 -p "Select network: ") +# net_ip=$(echo -e "$cn" | dmenu -l 10 -p "Select network: ") else net_ip=$cn fi @@ -14,4 +15,4 @@ case $1 in *) arg='-sP';; esac -nmap $arg $net_ip'.0/24' | grep -E $net_ip | sed 's/.*for //g' +nmap "$arg" "$net_ip.0/24" | grep -E "$net_ip" | sed 's/.*for //g' diff --git a/.scripts/unmount_drives.sh b/.scripts/unmount_drives.sh index b8fc269..64e2e52 100755 --- a/.scripts/unmount_drives.sh +++ b/.scripts/unmount_drives.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #============================================================================== # Name : unount_drives @@ -21,19 +21,18 @@ #============================================================================== -if [[ $(uname) == "OpenBSD" ]]; then +if [ "$(uname)" = "OpenBSD" ]; then - mounted=$(df | awk '{print $1" "$6}' | egrep -o '([cwsf]d[0-9]. /mnt.*)') + mounted=$(df | awk '{print $1" "$6}' | grep -Eo '([cwsf]d[0-9]. /mnt.*)') mount_point=$(echo "$mounted" | dmenu -l 10 | awk '{print $2}') - if [ $mount_point ]; then + if [ "$mount_point" ]; then dmenu -P -p "umount $mount_point | sudo " | sudo -S umount $mount_point\ && notify-send "Unmounted" "$mount_point"\ || notify-send -u critical "Error Unmounting" "$mount_point" fi - -elif [[ $(uname) == "Linux" ]]; then +elif [ "$(uname)" = "Linux" ]; then # df | awk '{print $1" "$6}' | grep "/mnt/" |\ chosen=$(\ @@ -43,7 +42,7 @@ chosen=$(\ -not -empty -name android*")}'|\ dmenu -i -p "Unmount volume" -l 10 ) -partion=$(echo $chosen | awk '{print $1}') # sda# +partition=$(echo $chosen | awk '{print $1}') # sda# file_type=$(echo $chosen | awk '{print $3}') # crypt | part mount_point=$(echo $chosen | awk '{print $4}') # /mnt/usb1 android_d=$(echo $chosen | awk '/android/') # /mnt/.android @@ -58,7 +57,7 @@ fi ask_kill(){ resp=$(echo -e "no\nyes" | dmenu -p "( $active_ps ) ps running, Force kill ? ") - if [[ "$resp" == "yes" ]]; then + if [ "$resp" = "yes" ]; then fuser -km $mount_point kill # umount -l /dev/sdX lazy unmount_func @@ -69,16 +68,16 @@ ask_kill(){ unmount_func(){ sync;dmenu -P -p "umount $mount_point | sudo " | sudo -S umount $mount_point;\ - sudo fsck /dev/$partion \ + sudo fsck /dev/$partition \ && notify-send "Unmounted" "$mount_point"\ || ask_kill } -# Unmount partion +# Unmount partition if [ $mount_point ]; then active_ps=$(fuser -vm $mount_point 2> /dev/null) active_ps=$(echo $active_ps | grep [0-9] | wc -l) - if [[ $active_ps -gt 0 ]]; then + if [ $active_ps -gt 0 ]; then ask_kill else unmount_func @@ -86,10 +85,10 @@ if [ $mount_point ]; then fi # If the drive is encrypted lock after umount -if [ "$file_type" == "crypt" ]; then +if [ "$file_type" = "crypt" ]; then dmenu -P -p "luksClose | sudo " |\ - sudo -S cryptsetup luksClose /dev/mapper/$partion\ - && notify-send "Locked" "$partion"\ - || notify-send -u critical "Error Locking" "$partion" + sudo -S cryptsetup luksClose /dev/mapper/$partition\ + && notify-send "Locked" "$partition"\ + || notify-send -u critical "Error Locking" "$partition" fi fi diff --git a/.scripts/xbps_base.txt b/.scripts/xbps_base.txt index 23c611a..e3f2506 100644 --- a/.scripts/xbps_base.txt +++ b/.scripts/xbps_base.txt @@ -2,18 +2,19 @@ VeraCrypt abook acpi aircrack-ng +aisleriot bluez clang cronie curl +dejavu-fonts-ttf +dropbox dunst exfat-utils fd firefox -font-awesome5 fonts-droid-ttf fuse-sshfs -gcr gcr-devel git gnome-sudoku @@ -39,6 +40,7 @@ mupdf mupdf-tools neofetch neomutt +nerd-fonts net-tools newsboat nmap @@ -50,24 +52,27 @@ pass patch pavucontrol pinentry-dmenu +pkg-config playerctl pulseaudio +python3-pip redshift sed shellcheck +simple-mtpfs speedtest-cli splint tcc terminus-font +time transmission-gtk unzip usbutils util-linux valgrind vifm -vim +vim-huge-python3 vlc -webkit2gtk webkit2gtk-devel wget whois @@ -81,5 +86,6 @@ xinit xorg-server xprop xrandr +xset xsetroot youtube-dl diff --git a/.vim/syntax/log.vim b/.vim/syntax/log.vim new file mode 100644 index 0000000..a42d969 --- /dev/null +++ b/.vim/syntax/log.vim @@ -0,0 +1,2 @@ +syn match statusline_o "\v<[a-zA-Z]+.c:.*function.*" +syn match statusline_g "\v<[a-zA-Z]+.c:[0-9]+:[0-9]+" -- 2.11.4.GIT