ssh tunnels

This commit is contained in:
Robin P. Clark 2025-01-21 10:26:09 +00:00
parent 7859bfab0d
commit aff87896e8
2 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,56 @@
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# 21JAN2025:
Instructions for VNC and file logging
via an ssh tunnel to an ETC 6075 touchscreen
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
# Login to dev using ssh -X
-------------------------------------------------------
# file Logging
-------------------------------------------------------
To log data files/can
On dev
dev$ ssh -p 1235 root@localhost "./can_rx | egrep 'O2|F1DF' " >> touchscreen_can_log.txt
This will log to dev data streamed from the touch screen via the shh tunnel.
-------------------------------------------------------
# VNC
-------------------------------------------------------
# This assumes the reverse_tunnel.sh is running on the target touch screen
to get this running log in from dev
dev$ ssh -p1235 root@localhost
# login password....
#
# more tunnel_vnc.sh
ssh -y -N -l touchscreen -R 1236:localhost:5900 dev.energytechnologycontrol.com
# ./tunnel_vnc.sh &
# exit # back to dev
display a VNC copy of the touchscreen GUI.
$dev vncviewer localhost:1236
VNC viewer should display. Leave terminal session logged in.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
RPC 21JAN2025
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

28
ppt_to_png.sh Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/bash
# Generate temporary file safely
temp_file=$(mktemp)
ppt "$1" > "$temp_file"
# Count lines directly
line_count=$(wc -l < "$temp_file")
# Calculate image height (e.g., 20 pixels per line, with a minimum height)
line_height=20
image_height=$((line_count * line_height))
[ "$image_height" -lt 70 ] && image_height=70 # Ensure a minimum height of 70 pixels
# Generate image with dynamic height and fixed-width font
convert \
-size 165x${image_height} \
xc:lightyellow \
-font Courier \
-pointsize 12 \
-fill blue \
-gravity center \
-draw "text 0,0 '$(cat "$temp_file")'" \
image.png
# Clean up temporary file
rm "$temp_file"