X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc;h=dc32a10de59354e13627c631abd2b4c6e11c51c4;hb=b714b0dde29aaf5e44d628c1d723077465e9c488;hp=d60af90a674155158c01557efad5eaf143c0c57c;hpb=6d1ec26482f86b0f2d9560ce3d04ea8c63297c25;p=distro-setup diff --git a/brc b/brc index d60af90..dc32a10 100644 --- a/brc +++ b/brc @@ -774,6 +774,50 @@ EOF done } +screenrtp() { + + local ip port xoffset + read -r ip port xoffset <<<"$@" + + setxenv + + if [[ ! $port ]]; then + port=9999 + fi + + while true; do + # By default, plugged in screen goes to the right side, so we need an + # offset that is the same as the laptop's x resolution. If we are in + # mirror mode, then we don't need an offset. + if [[ ! $xoffset ]]; then + xoffset=0 + laptop_x=$(xrandr | awk '$1 == "LVDS-1" {print $4}' | sed 's/x.*//') || { sleep 1; continue; } + total_x=$(xdpyinfo| awk '$1 == "dimensions:" {print $2}' | sed 's/x.*//') || { sleep 1; continue; } + screen2_res=$(xrandr | awk '$2 == "connected" && $1 != "LVDS-1" { print $3 }' | sed 's/+.*//') + if (( laptop_x < total_x )); then + xoffset=$laptop_x + fi + fi + + m ffmpeg -probesize 50M -thread_queue_size 50 \ + -video_size $screen2_res -f x11grab -framerate 30 -i :0.0+$xoffset.0 \ + -vcodec libx264 -g 1 -tune zerolatency -preset ultrafast -pix_fmt yuv420p -x264-params repeat-headers=1 \ + -f rtp_mpegts rtp://$ip:$port ||: + + + sleep 1 + done +} + +setxenv() { + if [[ ! $DISPLAY ]]; then + export DISPLAY=:0.0 + fi + if [[ ! $XAUTHORITY ]]; then + export XAUTHORITY=$HOME/.Xauthority + fi +} + #### end fsf section @@ -2046,9 +2090,9 @@ nags() { /usr/bin/nagstamon & } -# profanity screen +# profanity tmux profsrc() { - screen -RD -S profanity + screen -L profanity a } # i dont want to wait for konsole to exit... @@ -2447,20 +2491,14 @@ sk() { local quotes others ret quotes=2048,2068,2086,2206,2254 others=2029,2032,2033,2054,2164 - # Dont complain about sourced files if we aren't asking for them. - if [[ $1 != -x ]]; then - others+=,1091 - fi - shellcheck -W 999 -e $quotes,$others "$@" || ret=$? + shellcheck -x -W 999 -e $quotes,$others "$@" || ret=$? if (( ret >= 1 )); then echo "A template comment to disable is now in clipboard. eg: # shellcheck disable=SC2206 # reason" cbs "# shellcheck disable=SC" return $ret fi } -skx() { - sk -x "$@" -} + # sk with quotes. For checking scripts that we expect to take untrusted # input in order to verify we quoted vars. skq() { @@ -2480,49 +2518,24 @@ skmodified() { } -# sk on all the files in current git repo (except those excluded) +# sk on all the files in current git repo skgit() { - local f toplevel orig_dir tmp skip pattern - local -a ls_files excludes + local f toplevel orig_dir tmp + local -a ls_files sk_files toplevel=$(git rev-parse --show-toplevel) if [[ $PWD != "$toplevel" ]]; then orig_dir=$PWD cd $toplevel fi - excludes=( - 'disabled/*' - # sourced from brc2 - beet-data - # sourced from .bash_profile - .bashrc - ) - no_check_sourced=( - .bash_profile - ) - tmp=$(git ls-files | shuf) + # tracked & untracked files + tmp=$(git ls-files && git ls-files --others --exclude-standard) mapfile -t ls_files <<<"$tmp" for f in "${ls_files[@]}"; do - skip=false - for pattern in "${excludes[@]}"; do - if [[ $f == $pattern ]]; then - skip=true - break - fi - done - if $skip; then continue; fi - - check_source=-a - for pattern in "${no_check_sourced[@]}"; do - if [[ $f == "$pattern" ]]; then - check_source= - break - fi - done if sk-p "$f"; then - printf "================= %s\n" "$f" - sk $check_source --color=always $f || [[ $? == 1 ]] + sk_files+=("$f") fi done + sk "${sk_files[@]}" if [[ $orig_dir ]]; then cd $orig_dir fi @@ -3406,6 +3419,35 @@ if [[ $- == *i* ]]; then fi + +lp22viewers() { + v=0 + roomv=(0 0) + rooms=(jupiter saturn) + for ip in 209.51.188.25 live.fsf.org; do + out=$(curl -sS --insecure https://$ip/) + for i in 0 1 2; do + room=${rooms[i]} + while read -r n; do + v=$((v+n)) + roomv[$i]=$(( ${roomv[$i]} + n )) + done < <(printf "%s\n" "$out" | grep -Po "$room.*?current[^0-9]*[0-9]*" | grep -o '[0-9]*$' ) + done + done + printf "total: %s " $v + for i in 0 1; do + room=${rooms[i]} + printf "$room: %s " "${roomv[$i]}" + done + echo +} + +arpflush() { + local default_route_dev + default_route_dev=$(ip r show default | sed 's/.*dev \([^ ]*\).*/\1/' | head -n1) + m s ip n flush dev "$default_route_dev" +} + # * stuff that makes sense to be at the end