X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc;h=dc32a10de59354e13627c631abd2b4c6e11c51c4;hb=b714b0dde29aaf5e44d628c1d723077465e9c488;hp=7731b9cdd7c0652302300b7571bb663c4b134726;hpb=858993fb6c3e9351988b193e6c296e6ea7862501;p=distro-setup diff --git a/brc b/brc index 7731b9c..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... @@ -3375,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