Created
August 28, 2017 09:00
-
-
Save Neo-Oli/d55db97631b2e6da2ea179e15ebf915a to your computer and use it in GitHub Desktop.
My ssh setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export device=droid | |
export PATH=~/bin:${PATH} | |
export BROWSER=~/bin/browser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export device=work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
dev=$(cat ~/.externaldevice) | |
if [ -z "$dev" ];then | |
dev=droid | |
fi | |
$HOME/bin/$(basename $0)-$dev $@ | |
sleep 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ssh adbstinkpad DISPLAY=:0 noglob "firefox \"$@\"" | |
echo "opening on thinkpad" | |
sleep 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ssh adbwork "tmux new-window \"/cygdrive/c/Program\ Files\ \(x86\)/Mozilla\ Firefox/firefox.exe \\\"$@\\\";sleep 10\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _ __ _ | |
# ___ ___| |__ ___ ___ _ __ / _(_) __ _ | |
#/ __/ __| '_ \ _____ / __/ _ \| '_ \| |_| |/ _` | | |
#\__ \__ \ | | |_____| (_| (_) | | | | _| | (_| | | |
#|___/___/_| |_| \___\___/|_| |_|_| |_|\__, | | |
# |___/ | |
Host adb | |
Hostname localhost | |
Port 8022 | |
# Hide warnings closed ports are contacted | |
LogLevel QUIET | |
#adbthinkpad | |
RemoteForward 10022 localhost:22 | |
#adbwork | |
RemoteForward 11022 localhost:22 | |
#adbpc | |
RemoteForward 12022 localhost:22 | |
#http | |
LocalForward 8080 localhost:8080 | |
#https | |
LocalForward 8443 localhost:8443 | |
#privoxy | |
#LocalForward 8118 localhost:8118 | |
#tor | |
#LocalForward 9050 localhost:9050 | |
#raspi camera | |
LocalForward 13080 localhost:13080 | |
#aria2-rpc | |
LocalForward 6800 localhost:6800 | |
#mpd stream | |
LocalForward 8100 localhost:8100 | |
Host adbstinkpad | |
Hostname localhost | |
Port 10022 | |
User glow | |
Host adbwork | |
Hostname localhost | |
Port 11022 | |
User oliver.schmidhauser | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
setup(){ | |
#ssh | |
adb forward tcp:8022 tcp:8022 | |
#privoxy and tor with adb instead of ssh because of https://github.com/termux/termux-packages/issues/465 | |
adb forward tcp:9050 tcp:9050 | |
adb forward tcp:8118 tcp:8118 | |
if [ "$device" == "stinkpad" ] || [ "$device" == "media" ];then | |
mkdir -p ~/drive | |
sshfs adb:/storage/54E2-F956/Android/data/com.termux/files/drive ~/drive | |
fi | |
if [ "$device" == "work" ] || [ "$device" == "olipc" ];then | |
# we're running tmux here because windows has no concept of DISPLAY and it just needs to be run from a non-service process | |
tmux ls||tmux new-session -d | |
fi | |
} | |
connect(){ | |
echo "Connecting ..." | |
setup | |
ssh adb "~/bin/ext $device" | |
ssh adb -t "tmux ls||tmux new-session -d;tmux attach" | |
echo "Disconnected" | |
} | |
main(){ | |
if [ "$(basename $0)" == "autoconnect" ]; then : | |
while true; do : | |
connect | |
sleep 1 | |
done | |
else : | |
connect $0 | |
fi | |
} | |
main | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z "$1" ]];then | |
dev=droid | |
else | |
dev=$1 | |
fi | |
echo -en "$dev" >~/.externaldevice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment