You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
Somajit
SomajitDey
Computational Physicist (Ph.D.) & Open-Source Developer. Lead Maintainer: @securelay, @formonit
Setup current USER such that sudo doesn't ask for password
sudo echo hi # This sudo is to accept the current password, so that it won't ask for password for next few minutes
echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER
To restore the default behavior of sudo asking for password just remove the /etc/sudoers.d/$USER file
Setting up VNC for controlling remote desktop / screen sharing
In this tutorial we shall setup VNC such that we can remotely access a Linux desktop (Ubuntu 20.04) from a Windows 10 laptop.
The Ubuntu desktop hosts the VNC server, whereas the Windows machine hosts the client.
How to alias user@hostname:port for SSH. As a .conf file inside /etc/ssh_config.d directory
This file contains hidden or 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
alias x="nautilus ${PWD}" ; so that file explorer opens in current directory with command x
alias ls="ls -lt"
Seup git config name and email at your server
Setup terminal preferences
Networking
Expose server with tunnel. Make use of cron: crontab -e > @reboot tunnel -l /tmp/tunnel.log 22 and */1 * * * * tunnel -l /tmp/tunnel.log 22. Use tunnel because it is more or less portable and doesn't require sudo priviledge. Just install a portable socat in the same directory as tunnel (e.g. ~/.bin), if needed.
At your home-pc/laptop (client) setup a cronjob or add to ~/.bashrc : flock -n /tmp/tunnel.log tunnel -b <port> -l /tmp/tunnel.log <server-kid>:22
How to use Anydesk to connect to remote network with low bandwidth usage
Anydesk is usually used for accessing remote desktop, viz. the entire GUI shell. This, however, uses a lot of data.
If one wants to simply run commands remotely, then it's more efficient to use SSH by using Anydesk's TCP tunneling feature. TCP tunnelling also gives access to remote's network provided a SQUID web proxy is running @ remote, thus setting up a VPN effectively. Anydesk offers only one TCP tunneling in its FREE license.
To set up SSH, for example, to a Remote Linux server do the following:
Setup Anydesk server in remote. Make sure Create TCP tunnels is checked in Settings > Permissions.
Open Anydesk client in your Windows computer.
Sign in to your Anydesk Account, otherwise TCP tunneling would be greyed out.
How to setup Continuous Integration with GitHub Actions
Give your Personal Access Token (PAT) access to workflow.
Put the accompanying build.yml inside .github/workflows path inside your repository. Edit it as required. You may check the validity of the yaml file online.
On top of your repository's README.md, put the following badge:
This file contains hidden or 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
Parse GNU style long options (--opt optarg | --opt=optarg) as well as short Unix options (-ooptarg | -o optarg). Source: https://stackoverflow.com/a/28466267.
This file contains hidden or 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