Skip to content

Instantly share code, notes, and snippets.

@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active February 20, 2023 23:55
Install Syncthing on Linux
  • Install the necessary packages:
sudo apt-get install apt-transport-https ca-certificates
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update
sudo apt-get install syncthing
sudo apt-get install git
  • Start syncthing once:
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active October 3, 2022 08:58
Run Streamlit apps from within Google Colab
!pip install streamlit
!npm install localtunnel
!streamlit run http://app.py &>/dev/null&
!npx localtunnel --port 8501
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active July 5, 2021 18:58
SSH into Linux Subsystem for Windows
  • In /etc/ssh/sshd_conf, set UsePrivilegeSeparation to no
  • In /etc/ssh/sshd_conf, temporarily enable plaintext passwords
  • In /etc/ssh/sshd_conf, change port (e.g. to 23) to avoid confusion with Windows SSH server
  • sudo service ssh restart
  • Add alternative port as a new rule to Windows firewall
  • On the client: ssh-copy-id user@server
  • In /etc/ssh/sshd_conf, re-disable plaintext passwords

To fix Could not load host key ... error:

  • sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active December 15, 2020 13:20
Adapt KDE Plasma scaling to 4K monitor
@zentralwerkstatt
zentralwerkstatt / instructions.md
Created October 29, 2020 09:43
Get contents of S3 bucket
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active August 20, 2020 09:42
Change git history comprehensively
  • On a Mac, we might need to run first: git config --global core.trustctime false
  • Rebase: git rebase -i --root
  • Edit according to instructions
  • Set commit date as author date: git filter-branch -f --env-filter 'GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE; export GIT_COMMITTER_DATE'
  • Force push: git push origin +master
  • In case of errors: git rebase --abort
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active April 14, 2020 09:43
Basic Security
  • On the client: ssh-copy-id user@server
  • On the server, in etc/ssh/sshd_config: PasswordAuthentication no
  • sudo apt-get install ufw
  • sudo ufw allow ssh
  • sudo ufw enable
  • sudo apt install fail2ban
@zentralwerkstatt
zentralwerkstatt / instructions.md
Created May 15, 2019 17:51
Shared folder on Linux
  • Add user with home directory: sudo useradd -m username
  • As user, change default shell: chsh -s /bin/bash
  • Set temp. password: sudo passwd username
  • Create group: sudo groupadd groupname
  • Add users: usermod -a -G groupname username
  • Make shared directory: sudo mkdir /home/groupname
  • Set group for shared directory: sudo chgrp groupname /home/groupname
  • Add write access for group: sudo chmod g+w /home/groupname
  • "Set GID" for group (all files created owned by group): sudo chmod 2775 /home/groupname
  • Change to different user to test: su - username
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active April 14, 2020 09:43
Set up a "GitHub Pages"-style repository on a server
  • On the server:
sudo apt-get install git-core
cd ~
mkdir repo.git
cd repo.git
git init --bare
nano hooks/post-receive
  git --git-dir /home/user/repo/.git --work-tree /home/user/repo pull origin master
chmod +x hooks/post-receive
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active March 29, 2019 19:49
Unix cheat sheet
  • df -h: Show disk space for humans
  • scp file user@server:path/file: Transfer file over SSH
  • whereis command: Path to command
  • ssh user@server: Start SSH session (exit with exit)
  • lshw -short: Hardware information for humans
  • ls -lah dir: Show content of directory for humans, including hidden files
  • cd dir: Change directory
  • mkdir: Create directory
  • rm -rf dir: Delete full directory
  • rm file: Delete file