From 69d767ddc5b43de1420d3f16df53611edd5efd92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eirik=20Svag=C3=A5rd?= Date: Mon, 23 Mar 2020 11:14:49 +0100 Subject: [PATCH] More arduino and housecleaning --- linux.md | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/linux.md b/linux.md index 08d93ac..e5424aa 100644 --- a/linux.md +++ b/linux.md @@ -1,26 +1,17 @@ # Linux Cheats -## Set script as startup +## General (tested in Debian) + +### Set script as startup If, for some reason, apache isn't startup: > `sudo update-rc.d apache2 defaults` -## Check a package version/info +### Check a package version/info > `dpkg -l matrix-synapse` +
-## Arduino -Find what 'channel'(?) the Arduino is plugged in at: -`dmesg | grep tty` - -Do following commands to "talk" with an Arduino (with a set script): -> python -> import serial -> ser = serial.Serial('/dev/ttyACM0',115200) -> ser.readline() -> ser.write("PP\n") - ---- ## SSH Copy files to/from an SSH connection: (SSH format: `user@host:/path` ) > `scp ` @@ -28,7 +19,8 @@ Copy files to/from an SSH connection: (SSH format: `user@host:/path` ) Recursivly give directories execute privileges: (`-type f` for files instead) > `find /path/to/base/dir -type d -exec chmod +c {} +` ---- +
+ ## GROUPS Create groups > `groupadd ` @@ -36,7 +28,7 @@ Create groups Add user to a group > `usermod -a -G ` -## Open ports with iptables +### Open ports with iptables Don't do that. Use [UFW](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-debian-10) instead. @@ -47,17 +39,32 @@ Enable ufw service: > `sudo ufw enable` ++ [Source](https://www.linuxquestions.org/questions/linux-security-4/how-to-open-ports-with-iptables-237939/) ++ [Source2](https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands) +
-> [Source](https://www.linuxquestions.org/questions/linux-security-4/how-to-open-ports-with-iptables-237939/) -> -> [Source2](https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands) - - -## Partitions +### Partitions The following command is not permanent: > `mount /dev/sda11 /opt` To mount partition permanently, instert the following into `/etc/fstab`: > `UUID=03ec5dd3-45c0-4f95-a363-61ff321a09ff /opt ext4 defaults 0 2` +
+ +## Arduino +Find what 'channel'(?) the Arduino is plugged in at: +`dmesg | grep tty` + +Do following commands to "talk" with an Arduino (with a set script): +> python +> import serial +> ser = serial.Serial('/dev/ttyACM0',115200) +> ser.readline() +> ser.write("PP\n") + +To set the time of current clock-program, continue with: +> `from datetime import datetime` +> `ser.write("T"+datetime.now().strftime("%y%m%d0%w%H%M%S")+"\n")` +> `ser.readline()`