Skip to main content

Posts

Showing posts from March, 2022

xdg-open alternative handlr

 doas apk add handlr  handlr 0.6.4 USAGE:     handlr <SUBCOMMAND> FLAGS:     -h, --help       Prints help information     -V, --version    Prints version information SUBCOMMANDS:     list      List default apps and the associated handlers     open      Open a path/URL with its default handler     set       Set the default handler for mime/extension     unset     Unset the default handler for mime/extension     launch    Launch the handler for specified extension/mime with optional arguments     get       Get handler for this mime/extension     add       Add a handler for given mime/extension Note that the first handler is the default handlr get .mkv video/x-matroska     https://github.com/chmln/handlr

alpine linux firefox bubblewrap

 doas apk add bubblewrap firefox ---------------------------------------------- nano bwfirefox     exec bwrap \      --ro-bind /usr/share /usr/share/ \      --ro-bind /usr/lib /usr/lib \      --ro-bind /lib/ld-musl-x86_64.so.1   /lib/ld-musl-x86_64.so.1  \      --ro-bind /lib/libz.so.1 /lib/libz.so.1 \      --ro-bind /lib/libmount.so.1 /lib/libmount.so.1 \      --ro-bind /lib/libuuid.so.1 /lib/libuuid.so.1 \       --ro-bind /lib/libblkid.so.1 /lib/libblkid.so.1 \      --proc /proc \      --dev /dev \      --dev-bind /dev/snd /dev/snd \      --ro-bind /etc/resolv.conf /etc/resolv.conf \      --ro-bind /etc/gtk-3.0 /etc/gtk-3.0 \      --ro-bind /etc/fonts /etc/fonts \      --ro-bind /etc/pulse /etc/pulse \      --tmpfs /run \      --ro-bind /tmp/"$(id -u)"-runtime-dir /wayland-1 /tmp/"$(id -u)"-runtime-dir/ wayland-1 \      --bind ~/.mozilla ~/.mozilla \      --bind ~/.cache/mozilla ~/.cache/mozilla \      --bind ~/Downloads ~/Downloads \      --chdir ~/ \      --un

bubblewrap firefox in home directory install

 cat ~/.local/bin/bfirefox  bwrap \ --symlink usr/bin /bin \ --symlink usr/lib /lib \ --symlink usr/lib64 /lib64 \ --ro-bind /usr/lib /usr/lib \ --ro-bind /usr/lib64 /usr/lib64 \ --ro-bind /home/kai/opt/firefox /home/kai/opt/firefox \ --ro-bind /usr/share/gtk-3.0 /usr/share/gtk-3.0 \ --ro-bind /usr/share/fontconfig /usr/share/fontconfig \ --ro-bind /usr/share/fonts /usr/share/fonts \ --ro-bind /usr/share/icons /usr/share/icons \ --ro-bind /usr/share/mime /usr/share/mime \ --ro-bind /usr/share/icu /usr/share/icu \ --ro-bind /usr/share/drirc.d /usr/share/drirc.d \ --ro-bind /usr/share/glib-2.0 /usr/share/glib-2.0 \ --ro-bind /usr/share/glvnd /usr/share/glvnd \ --ro-bind /usr/share/libdrm /usr/share/libdrm \ --ro-bind /usr/share/X11/xkb /usr/share/X11/xkb \ --ro-bind /etc/resolv.conf /etc/resolv.conf \ --ro-bind /usr/share/ca-certificates /usr/share/ca-certificates \ --ro-bind /etc/ssl /etc/ssl \ --ro-bind /etc/fonts /etc/fonts \ --ro-bind /etc/ca-certificates /etc/ca-certificates \ --dir

waybar new config

 cat .config/warbar/config pacman -S otf-font-awesome jq grim slurp pcmanfm-gtk3 foot light pavucontrol yay -S wlsunset iwgtk https://repo.archlinuxcn.org/x86_64/iwgtk-0.4-2-x86_64.pkg.tar.zst https://cf-builds.garudalinux.org/repos/chaotic-aur/x86_64/wlsunset-0.2.0-2-x86_64.pkg.tar.zst --------------------------------------------------------------------------------------      "layer": "bottom",     "output": "eDP-1",      "position": "top",     "spacing": 2,         "modules-center":["custom/flux"],     "modules-left": ["sway/workspaces","sway/mode","sway/window","custom/ftog","custom/close"],     "modules-right": ["custom/playerctl","pulseaudio", "network", "backlight", "battery","clock","tray"],           "tray": {     // "icon-size": 21

webacm using mpv

  v4l2-ctl --list-formats-ext  ioctl: VIDIOC_ENUM_FMT     Type: Video Capture     [0]: 'MJPG' (Motion-JPEG, compressed)         Size: Discrete 1280x720             Interval: Discrete 0.033s (30.000 fps)         Size: Discrete 960x540             Interval: Discrete 0.033s (30.000 fps)         Size: Discrete 848x480             Interval: Discrete 0.033s (30.000 fps)         Size: Discrete 640x480             Interval: Discrete 0.033s (30.000 fps)         Size: Discrete 640x360             Interval: Discrete 0.033s (30.000 fps)     [1]: 'YUYV' (YUYV 4:2:2)         Size: Discrete 1280x720             Interval: Discrete 0.100s (10.000 fps)         Size: Discrete 640x480             Interval: Discrete 0.033s (30.000 fps)         Size: Discrete 640x360             Interval: Discrete 0.033s (30.000 fps)         Size: Discrete 424x240             Interval: Discrete 0.033s (30.000 fps)         Size: Discrete 320x240             Interval: Discrete 0.033s (30.000 fps)         Size:

pi to specified precision python

 pi value using python use python test.py 100   https://www.w3resource.com/projects/python/python-projects-1.php   PI:  3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068 #!/usr/bin/python3 # Calculate PI number using this formula: # x[n+1] = x[n] + sin(x[n]) # # x[n+1] = x[n] + x[n] + x[n]**3/fact(3) - x[n]**5/fact(5) + x[n]**7/fact(7) - x[n]**9/fact(9) + .... from decimal import getcontext , Decimal import sys if len ( sys . argv ) < 2 : print ( 'Not enough arguments' ) quit () precision = int ( sys . argv [ 1 ]) excess_prec = 2 prec_cur = 100 if precision > 100 else precision getcontext (). prec = prec_cur + excess_prec second = Decimal ( 3 ) # Current element for PI queue_cur = [ Decimal ( 0 ), Decimal ( 0 ), Decimal ( 0 ), second ] qq_append = queue_cur . append qq_pop = queue_cur . pop limit = Decimal ( 10 ) ** (- prec_cur - excess_prec ) while True : sec_sq = second * second

tesseract-ocr

 conda activate  conda install -c conda-forge tesseract     package                    |            build     ---------------------------|-----------------     leptonica-1.82.0           |       h950d820_0         2.6 MB  conda-forge     libarchive-3.5.2           |       hccf745f_1         1.6 MB  conda-forge     lzo-2.10                   |    h516909a_1000         314 KB  conda-forge     tesseract-5.0.1            |       h84e3e21_0       171.4 MB  conda-forge     ------------------------------------------------------------                                            Total:       175.9 MB tesseract Usage:   tesseract --help | --help-extra | --version   tesseract --list-langs   tesseract imagename outputbase [options...] [configfile...] OCR options:   -l LANG[+LANG]        Specify language(s) used for OCR. NOTE: These options must occur before any configfile. Single options:   --help                Show this help message.   --help-extra          Show extra help for advanced users.   -

coqui tts

to do on web without local install  https://colab.research.google.com/drive/1iAe7ZdxjUIuN6V4ooaCt0fACEGKEn7HW?usp=sharing signin &/ fork    Local install::  tmpfs in ram should be more than 4gb mine failed to insall pytorch due to insufficient ram. so mount /tmp  to another loc if its in tmpfs/ram  mkdir ~/opt/coquitts virtualenv -p python3 ~/opt/coquitts source ~/opt/coquitts/bin/activate pip install tts tts --list_models   Name format: type/language/dataset/model 1: tts_models/multilingual/multi-dataset/your_tts 2: tts_models/en/ek1/tacotron2 3: tts_models/en/ljspeech/tacotron2-DDC [already downloaded] 4: tts_models/en/ljspeech/tacotron2-DDC_ph 5: tts_models/en/ljspeech/glow-tts 6: tts_models/en/ljspeech/speedy-speech 7: tts_models/en/ljspeech/tacotron2-DCA 8: tts_models/en/ljspeech/vits 9: tts_models/en/ljspeech/fast_pitch 10: tts_models/en/vctk/sc-glow-tts 11: tts_models/en/vctk/vits 12: tts_models/en/vctk/fast_pitch 13: tts_models/en/sam/tacotron-DDC 14: tts_mod

coqui stt(speech to text)

python3 -m venv $HOME/coqui-stt-venv/ or virtualenv  $HOME/coqui-stt-venv/ python -m pip install coqui-stt-model-manager stt-model-manager  firefox http://127.0.0.1:38450/  downloads model to $HOME/.local/share/coqui/models folder  ls  $HOME/.local/share/coqui/models  'English STT v1.0.0-huge-vocab' models.json #install binary using python   python -m pip install -U pip && python -m pip install stt   ##using binary   stt --model model.tflite --scorer huge-vocabulary.scorer --audio my_audio_file.wav      or https://github.com/coqui-ai/STT/releases https://github.com/coqui-ai/STT/releases/latest     install binary from github release :: download native_clinet.tflite* https://github.com/coqui-ai/STT/releases/download/v1.2.0/native_client.tflite.Linux.tar.xz https://github.com/coqui-ai/STT/releases/download/v1.2.0/native_client.tflite.Windows.tar.xz   https://stt.readthedocs.io/en/latest/ https://github.com/coqui-ai/STT  

mozilla deepsppech test

 pip install virtualenv virtualenv -p python3 $HOME/opt/deepspeech/ source $HOME/opt/deepspeech/bin/activate  pip3 install deepspeech  pip3 install --upgrade deepspeech  pip3 install deepspeech-gpu  ##for supported nvidia gpu +cuda   python3 -m pip install deepspeech --user   see https://github.com/mozilla/DeepSpeech/releases for updated links   wget https://github.com/mozilla/DeepSpeech/releases/download/v0.9.3/deepspeech-0.9.3-models.scorer wget https://github.com/mozilla/DeepSpeech/releases/download/v0.9.3/deepspeech-0.9.3-models.pbmm         ##for input via microphone  git clone https://github.com/mozilla/DeepSpeech-examples --depth=1 for deps https://github.com/mozilla/DeepSpeech-examples/tree/r0.9/vad_transcriber sudo xbps-install portaudio-devel [ debian:portaudio19-dev, archlinux has devel files in portaudio] pip install -r requirements.txt        #cmd to run via microphone  python ~/opt/deepspeech/ DeepSpeech-examples/ mic_vad_streaming/mic_vad_streaming.py -m ~/opt/dee

sxhkdrc

 cat ~/.config/sxhkd/sxhkdrc super + Escape pkill -USR1 -x sxhkd super+Return st super + d rofi -show drun -show-icons super+shift+r killall -q dwmblockss ; setsid dwmblocks super + shift + q killall dwm super + Print $HOME/bin/dmenu-screenshot super+w apulse firefox {XF86MonBrightnessUp,XF86MonBrightnessDown,control+XF86MonBrightnessUp,control+XF86MonBrightnessDown} light {-A 1,-U 1,-A 5,-U 5}; \ pkill -RTMIN+2 dwmblocks;\ get_brightness=$(light | cut -f 1 -d '.'); \ dunstify " Brightness: " $get_brightness -t 1000 -r 1 {XF86AudioRaiseVolume,XF86AudioLowerVolume,XF86AudioMute} amixer sset Master {5 %+,5% -,toggle} ; \ pkill -RTMIN+10 dwmblocks ;\ vol=$(amixer get Master | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q" );\ dunstify " Speaker " $vol -t 1000 -r 1 super+e pcmanfm super+m dmenumount super+shift+m dmenuumount {XF86AudioPlay,su

nnn void

    sudo xbps-install readline-devel pkg-config ncurses-devel git clone --depth=1 https://github.com/jarun/nnn cd nnn make  or  sudo make strip install for icos make O_ICONS=1 or make O_NERD=1   https://github.com/jarun/nnn/wiki/Usage#dependencies   cat .profile BLK="0B" CHR="0B" DIR="04" EXE="06" REG="00" HARDLINK="06" SYMLINK="06" MISSING="00" ORPHAN="09" FIFO="06" SOCK="0B" OTHER="06" export NNN_FCOLORS="$BLK$CHR$DIR$EXE$REG$HARDLINK$SYMLINK$MISSING$ORPHAN$FIFO$SOCK$OTHER" export NNN_BMS="d:$HOME/Documents;h:$HOME;D:$HOME/Downloads/;p:$HOME/mnt/po;a:$HOME/mnt/aps;o:$HOME/mnt/oppo;l:$HOME/mnt/lib;c:$HOME/.config" export NNN_FIFO=/tmp/nnn.fifo export NNN_PLUG='f:finder;o:fzopen;p:mocplay;d:diffs;t:nmount;v:imgview;m:!mpv --player-operation-mode=pseudo-gui -- $nnn'   https://github.com/jarun/nnn/wiki