Krolyxon
Commit 69905fb

Branches

Refs →

dotfiles-x1169905fb

changes

Author
krolyxon
Date
2022-10-20 07:59 +0530
Parent
bf696a1
Commit
69905fb8727198e75bda617e75c3544032faf273

+84 −30

9 files changed

  1. M .config/shell/profile +1 −0
  2. M .local/bin/maimshot +0 −1
  3. D .local/bin/metadata +0 −12
  4. A .local/bin/pirokit +68 −0
  5. M .local/bin/sbar +1 −1
  6. A .local/bin/sd +11 −0
  7. D .local/bin/spammer +0 −15
  8. M .local/bin/upfile +2 −1
  9. M .local/share/vocab/words.txt +1 −0
M .config/shell/profile View
@@ -28,6 +28,7 @@ export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
2828 export FZF_DEFAULT_OPTS="--layout=reverse --height 40%"
2929 export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android"
3030 export PATH=$PATH:$HOME/.local/bin
31+export PATH=$PATH:$HOME/.local/pbin # personal bin
3132 export PATH="$PATH:$XDG_DATA_HOME/cargo/bin"
3233
3334 export MPD_HOST="localhost"
M .local/bin/maimshot View
@@ -7,5 +7,4 @@ case "$(printf "a selected area (copy)\\ncurrent window (copy)\\nfull screen (co
77 "a selected area") maim -s ~/pix/ss/pic-selected-"$(date '+%y-%m-%d-%H-%M').png" ;;
88 "current window") maim -i "$(xdotool getactivewindow)" ~/pix/ss/pic-window-"$(date '+%y-%m-%d-%H-%M').png" ;;
99 "full screen") sleep 0.2 ; maim ~/pix/ss/pic-full-"$(date '+%y-%m-%d-%H-%M').png" ;;
10−
1110 esac
D .local/bin/metadata View
@@ -1,12 +0,0 @@
1−#!/bin/sh
2−if [ -z "$*" ]; then
3− input_file=$(fzf)
4−else
5− input_file=$*
6−fi
7−read -p "Title: " title
8−read -p "Artist: " artist
9−read -p "album: " album
10−output_name="metadata-$input_file"
11−ffmpeg -i "$input_file" -metadata title="$title" -metadata artist="$artist" -metadata album="$album" -c copy "$output_name"
12−mv -f "$output_name" "$input_file"
A .local/bin/pirokit View
@@ -0,0 +1,68 @@
1+#!/usr/bin/bash
2+
3+mkdir -p $HOME/.cache/pirokit
4+
5+if [ -z $1 ]; then
6+ query=$(echo "" | dmenu -p "Search Torrent: ")
7+else
8+ query=$1
9+fi
10+
11+baseurl="https://1337x.to"
12+cachedir="$HOME/.cache/pirokit"
13+query="$(sed 's/ /+/g' <<<$query)"
14+
15+#curl -s https://1337x.to/category-search/$query/Movies/1/ > $cachedir/tmp.html
16+curl -s https://1337x.to/search/$query/1/ > $cachedir/tmp.html
17+
18+# Get Titles
19+grep -o '<a href="/torrent/.*</a>' $cachedir/tmp.html |
20+ sed 's/<[^>]*>//g' > $cachedir/titles.bw
21+
22+result_count=$(wc -l $cachedir/titles.bw | awk '{print $1}')
23+if [ "$result_count" -lt 1 ]; then
24+ notify-send "😔 No Result found. Try again 🔴"
25+ exit 0
26+fi
27+
28+
29+# Seeders and Leechers
30+grep -o '<td class="coll-2 seeds.*</td>\|<td class="coll-3 leeches.*</td>' $cachedir/tmp.html |
31+ sed 's/<[^>]*>//g' | sed 'N;s/\n/ /' > $cachedir/seedleech.bw
32+
33+# Size
34+grep -o '<td class="coll-4 size.*</td>' $cachedir/tmp.html |
35+ sed 's/<span class="seeds">.*<\/span>//g' |
36+ sed -e 's/<[^>]*>//g' > $cachedir/size.bw
37+
38+# Links
39+grep -E '/torrent/' $cachedir/tmp.html |
40+ sed -E 's#.*(/torrent/.*)/">.*/#\1#' |
41+ sed 's/td>//g' > $cachedir/links.bw
42+
43+
44+
45+# Clearning up some data to display
46+sed 's/\./ /g; s/\-/ /g' $cachedir/titles.bw |
47+ sed 's/[^A-Za-z0-9 ]//g' | tr -s " " > $cachedir/tmp && mv $cachedir/tmp $cachedir/titles.bw
48+
49+awk '{print NR " - ["$0"]"}' $cachedir/size.bw > $cachedir/tmp && mv $cachedir/tmp $cachedir/size.bw
50+awk '{print "[S:"$1 ", L:"$2"]" }' $cachedir/seedleech.bw > $cachedir/tmp && mv $cachedir/tmp $cachedir/seedleech.bw
51+
52+# Getting the line number
53+LINE=$(paste -d\ $cachedir/size.bw $cachedir/seedleech.bw $cachedir/titles.bw |
54+ dmenu -i -l 25 |
55+ cut -d\- -f1 |
56+ awk '{$1=$1; print}')
57+
58+url=$(head -n $LINE $cachedir/links.bw | tail -n +$LINE)
59+fullURL="${baseurl}${url}/"
60+
61+# Requesting page for magnet link
62+curl -s $fullURL > $cachedir/tmp.html
63+magnet=$(grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*" $cachedir/tmp.html | head -n 1)
64+
65+transadd "$magnet"
66+
67+# Simple notification
68+notify-send "⬇️ Start downloading File 📁"
M .local/bin/sbar View
@@ -10,7 +10,7 @@ update_cpu () {
1010 }
1111
1212 update_memory () {
13− memory=" $(free -h | sed -n "2s/\([^ ]* *\)\{2\}\([^ ]*\).*/\2/p")"
13+ memory=" $(free -h --si | sed -n "2s/\([^ ]* *\)\{2\}\([^ ]*\).*/\2/p")"
1414 }
1515
1616 update_time () {
A .local/bin/sd View
@@ -0,0 +1,11 @@
1+#!/bin/sh
2+
3+# Open a terminal window in the same directory as the currently active window.
4+
5+PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
6+PID="$(pstree -lpA "$PID")"
7+PID="${PID##*"${SHELL##*/}"(}"
8+PID="${PID#*lf(}"
9+PID="${PID%%)*}"
10+cd "$(readlink /proc/"$PID"/cwd)" || return 1
11+"$TERMINAL"
D .local/bin/spammer View
@@ -1,15 +0,0 @@
1−#!/bin/sh
2−
3−i=0
4−
5−if [ -z $1 ]; then
6− read -p "enter query: " query
7−else
8− query=$1
9−fi
10−
11−while [ $i -le 100 ]
12−do
13− xdotool type "$query" ;xdotool key KP_Enter; sleep 1 ;
14−
15−done
M .local/bin/upfile View
@@ -8,5 +8,6 @@ fi
88
99 [ -z "$file" ] && exit
1010
11−curl -F"file=@$file" 0x0.st | xclip -sel c
11+# curl -F"file=@$file" 0x0.st | xclip -sel c
12+curl -F"file=@$file" 0.tildevarsh.in | xclip -sel c
1213 notify-send "The url has been copied to your clipboard. $(xclip -sel c -o)"
M .local/share/vocab/words.txt View
@@ -85,3 +85,4 @@ apprehension -> anziety or fear that something bad or unpleasant will happen
8585 reprise -> a repeated passage in music
8686 reluctant -> unwilling and hesitant; disinclined
8787 trait -> a distinguishing quality or characteristic, typically one belonging to a person.
88+pedantic -> excessively concerned with minor details or rules; overscrupulous.