Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# In lieu of memory-log.sh
# mount /var/log on tmpfs to not wear down the eMMC flash chip
ISTMPFS=$(/bin/mount | /bin/grep -c "/var/log type tmpfs")
if [ "$ISTMPFS" = 0 ]; then
mount -t tmpfs -o size=100M tmpfs /var/log
#if we mount while the programs are still active and they keep their logfiles open, they keep on writing to the
@quantum77
quantum77 / create-accounts.sh
Created April 6, 2020 16:41
An extension to Lunar's Tesla scripts
#!/bin/sh
# Adds your password and SSH pub key to 3 users. root, tesla, yourUsername
if [ "$accountUserToSaveToCar" = "yourUsername" ] || [ -z "$accountUserToSaveToCar" ]; then
echo "Please set config parameter accountUserToSaveToCar"
exit 1
fi
if [ "$accountPassToSaveToCar" = "myCarIsRooted" ] || [ -z "$accountPassToSaveToCar" ]; then
@quantum77
quantum77 / listen-for-code.sh
Created April 5, 2020 21:21
An extension to Lunar's Tesla scripts
#!/bin/sh
cidIp="192.168.90.100"
cidPort="4070"
# shellcheck disable=SC2154
mainPath="$homeOfLunars/scripts"
pattern=AccessPopup
last_command="NoNe"
if ps ax | grep "$0" | grep -v $$ | grep bash | grep -v grep; then
echo "The script is already running."
@quantum77
quantum77 / copy-tokens.sh
Created April 4, 2020 20:26
An extension to Lunar's Tesla scripts
#!/bin/sh
# In lieu of copy-tokens-to-ic.sh and tokens-to-php.sh
while inotifywait -e modify /var/etc/saccess/tesla1; do
case $TOKENS_IC in
true|1|on|yes)
echo "Copying tokens to ic:/home/tesla/"
scp -qr /var/etc/saccess/tesla* 192.168.90.101:/home/tesla/
;;
@quantum77
quantum77 / config.sh
Last active April 7, 2020 16:40
An extension to Lunar's Tesla scripts
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
# Changed from /home/ because a factory reset will wipe out Lunars in /home/ but will remain in /var/
export homeOfLunars="/var/lunars"
# Turn on/off firewall to lock out Tesla (true/false)
export FIREWALL_ON="true"
@quantum77
quantum77 / autopilot-autosteer.sh
Created April 2, 2020 17:00
An extension to Lunar's Tesla scripts
#!/bin/sh
# Allows autosteer at all speeds
# Does not disable autopilot nag
KEY1="GUI_disableAutosteerRestrictions"
KEY2="GUI_handsOnRequirementDisable"
WANTSTATE="true"
while true; do
@quantum77
quantum77 / firewall-tesla.sh
Last active April 4, 2020 16:54
An extension to Lunar's Tesla scripts
#!/bin/sh
# In lieu of block-tesla-ssh.sh
# Clean up tables
/sbin/iptables -D INPUT -p udp --dport 18466 -m string --algo bm --string 'req' -j LOG_REJECT > /dev/null 2>&1
/sbin/iptables -D OUTPUT -s 10.2.3.0/24 -d 10.2.3.1/32 -j ACCEPT > /dev/null 2>&1
/sbin/iptables -D INPUT -s 10.2.3.1/32 -d 10.2.3.0/24 -j ACCEPT > /dev/null 2>&1
/sbin/iptables -D INPUT -i parrot -p tcp -m tcp --dport 4035 -j LOG_REJECT > /dev/null 2>&1
/sbin/iptables -D INPUT -i tun0 -p tcp -m tcp --dport 4035 -j LOG_REJECT > /dev/null 2>&1
/sbin/iptables -D INPUT -i wwan0 -p tcp -m tcp --dport 4035 -j LOG_REJECT > /dev/null 2>&1