Getting your public key from Github ... with wget!
I kind of saw it when installing Ubuntu 18 from scratch. But it is super awesome!
Just replace test with your authorized_keys file and profit!
#linux
I kind of saw it when installing Ubuntu 18 from scratch. But it is super awesome!
wget -O - https://github.com/snakers4.keys >> test
Just replace test with your authorized_keys file and profit!
#linux
Creating a new user
With the above hack, user creation can be done as easy as:
With the above hack, user creation can be done as easy as:
USER="YOUR_USER" && \#linux
GROUP="YOUR_GROUP" && \
sudo useradd $USER && \
sudo adduser $USER $GROUP && \
sudo mkdir -p /home/$USER/.ssh/ && \
sudo touch /home/$USER/.ssh/authorized_keys && \
sudo chown -R $USER:$USER /home/$USER/.ssh/ && \
sudo wget -O - https://github.com/$USER.keys | sudo tee -a /home/$USER/.ssh/authorized_keys
Environment setup for DS / ML / DL
Some time ago made a small guide for setting up an environment on a black Ubuntu machine.
If works both for CV and NLP.
If you like this, please tell me, I will add newer things:
- nvtop;
- CUDA10 with PyTorch 1.0;
- Scripts for managing GPU fan speed;
http://github.com/snakers4/gpu-box-setup/
#deep_learning
#linux
Some time ago made a small guide for setting up an environment on a black Ubuntu machine.
If works both for CV and NLP.
If you like this, please tell me, I will add newer things:
- nvtop;
- CUDA10 with PyTorch 1.0;
- Scripts for managing GPU fan speed;
http://github.com/snakers4/gpu-box-setup/
#deep_learning
#linux
GitHub
GitHub - snakers4/gpu-box-setup
Contribute to snakers4/gpu-box-setup development by creating an account on GitHub.
Linux subsystem in Windows 10
It works and installs in literally 2 clicks (run one command in Powershell and then just one-click install your Linux distro of choice in Windows Store (yes, this very funny indeed))!
Why would you need this?
To make and backup files on one command for example =)
Something like this becomes reality on Windows:
Also, you may add
Also other potential use cases:
- You are somehow vendor locked (I depend on proprietary drivers for my thunderbolt port to attach an external GPU) or just are used to Windows' windows (or are just lazy to install Linux);
- You need one particular Linux program or you need to quickly test something / do not want to bother replicating your environment under Windows (yes, you can also run Docker, but there will be some learning curve);
- You run all of your programs remotely, and use your Windows machine as a thin client, but sometimes you need git / bash / rsync - i.e. to download movies from your personal NAS;
#linux
It works and installs in literally 2 clicks (run one command in Powershell and then just one-click install your Linux distro of choice in Windows Store (yes, this very funny indeed))!
Why would you need this?
To make and backup files on one command for example =)
Something like this becomes reality on Windows:
cd /mnt/d/ && \
TIME=`date +%b-%d-%y` && \
FILENAME=working_files_tar-$TIME.tar.gz && \
INCREMENTAL_FILE=backup_data.snar && \
echo 'Using folderlist' $FOLDERS && \
tar -czg $(<folders_backup.txt) --listed-incremental=$INCREMENTAL_FILE --verbose -f $FILENAME
Also, you may add
rsync
or scp
and you are good to go!Also other potential use cases:
- You are somehow vendor locked (I depend on proprietary drivers for my thunderbolt port to attach an external GPU) or just are used to Windows' windows (or are just lazy to install Linux);
- You need one particular Linux program or you need to quickly test something / do not want to bother replicating your environment under Windows (yes, you can also run Docker, but there will be some learning curve);
- You run all of your programs remotely, and use your Windows machine as a thin client, but sometimes you need git / bash / rsync - i.e. to download movies from your personal NAS;
#linux
A bit of lazy Sunday admin stuff
Monitoring you CPU temperature with email notifications
- Change CPU temp to any metric you like
- Rolling log
- Sending email only one time, if the metric becomes critical (you can add an email when metric becomes non-critical again)
https://gist.github.com/snakers4/cf0ffd57c3ef7f4e2e25f6b3347dcdec
Setting up a GPU box on Ubuntu 18.04 from scratch
https://github.com/snakers4/gpu-box-setup/
#deep_learning
#linux
Monitoring you CPU temperature with email notifications
- Change CPU temp to any metric you like
- Rolling log
- Sending email only one time, if the metric becomes critical (you can add an email when metric becomes non-critical again)
https://gist.github.com/snakers4/cf0ffd57c3ef7f4e2e25f6b3347dcdec
Setting up a GPU box on Ubuntu 18.04 from scratch
https://github.com/snakers4/gpu-box-setup/
#deep_learning
#linux
Gist
Plain temperature monitoring in Ubuntu 18.04
Plain temperature monitoring in Ubuntu 18.04. GitHub Gist: instantly share code, notes, and snippets.
Tracking your hardware ... for data science
For a long time I though that if you really want to track all your servers' metrics you need Zabbix (which is very complicated).
A friend recommended me an amazing tool
- https://prometheus.io/docs/guides/node-exporter/
It installs and runs literally in minutes.
If you want to auto-start it properly, there are even a bit older Ubuntu packages and systemd examples
- https://github.com/prometheus/node_exporter/tree/master/examples/systemd
Dockerized metric exporters for GPUs by Nvidia
- https://github.com/NVIDIA/gpu-monitoring-tools/tree/master/exporters/prometheus-dcgm
It also features extensive alerting features, but they are very difficult to easily start, there being no minimal example
- https://prometheus.io/docs/alerting/overview/
- https://github.com/prometheus/docs/issues/581
#linux
For a long time I though that if you really want to track all your servers' metrics you need Zabbix (which is very complicated).
A friend recommended me an amazing tool
- https://prometheus.io/docs/guides/node-exporter/
It installs and runs literally in minutes.
If you want to auto-start it properly, there are even a bit older Ubuntu packages and systemd examples
- https://github.com/prometheus/node_exporter/tree/master/examples/systemd
Dockerized metric exporters for GPUs by Nvidia
- https://github.com/NVIDIA/gpu-monitoring-tools/tree/master/exporters/prometheus-dcgm
It also features extensive alerting features, but they are very difficult to easily start, there being no minimal example
- https://prometheus.io/docs/alerting/overview/
- https://github.com/prometheus/docs/issues/581
#linux
prometheus.io
Monitoring Linux host metrics with the Node Exporter | Prometheus
An open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.
Cool docker function
View aggregate load stats by container
https://docs.docker.com/engine/reference/commandline/stats/
#linux
View aggregate load stats by container
https://docs.docker.com/engine/reference/commandline/stats/
#linux
Docker Documentation
docker container stats
Tricky rsync flags
Rsync is the best program ever.
I find these flags the most useful
Sometimes first three flags get confusing.
#linux
Rsync is the best program ever.
I find these flags the most useful
--ignore-existing (ignores existing files)
--update (updates to newer versions of files based on ts)
--size-only (uses file-size to compare files)
-e 'ssh -p 22 -i /path/to/private/key' (use custom ssh identity)
Sometimes first three flags get confusing.
#linux
Sampler - visualization for any shell command
A cool mix between glances and prometheus
https://github.com/sqshq/sampler
#linux
A cool mix between glances and prometheus
https://github.com/sqshq/sampler
#linux
GitHub
GitHub - sqshq/sampler: Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.
Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file. - sqshq/sampler
SSH hopping from Windows?
Yeah, finally I found a recipe.
I always was one flag away from it.
Rsync at your pleasure and have your key only on your laptop!
You just need to:
(0) Use PuTTY / PuTTT-gen to create your ssh key (note that putty format and open-ssh format are different!)
(1) (or just import your open-ssh key into PuTTY-gen if you have it)
(2) Add your private key to pageant (PuTTY authentication agent)
(3) Do not forget to check
(5) Go to
Now you can rsync as much as you want.
Also inside of tmux.
#linux
Yeah, finally I found a recipe.
I always was one flag away from it.
Rsync at your pleasure and have your key only on your laptop!
You just need to:
(0) Use PuTTY / PuTTT-gen to create your ssh key (note that putty format and open-ssh format are different!)
(1) (or just import your open-ssh key into PuTTY-gen if you have it)
(2) Add your private key to pageant (PuTTY authentication agent)
(3) Do not forget to check
Allow agent forwarding
flag in PuTTY under Connection => SSH => Auth
(4) SSH into your server(5) Go to
/etc/ssh/ssh_config
(6) Uncomment and change the ForwardAgent yes
lineNow you can rsync as much as you want.
Also inside of tmux.
#linux
Spark in me
2020 DS / ML Digest 2 Highlights - New STT benchmarks from FAIR - Analysis of GPT-2 by thegradient - Google’s Meena, a 2.6 billion parameter end-to-end trained neural conversational model (not AGI ofc) - OpenAI now uses PyTorch - LaserTag - cool idea on…
Setting up Wi-Fi on a Headless Server
Yeah, that's a pain in the ass!
Chicken and egg problem - you need to install packages, but you need to set-up Wi-Fi first.
So first you need to install packages ... by copying them via USB stick.
Remember CD-ROM sneakernet? =)
Also making Wi-Fi robust to reboots is a pain.
This guides worked for me on Ubuntu 18.04.3 server:
- https://www.linuxbabe.com/command-line/ubuntu-server-16-04-wifi-wpa-supplicant
-
- better use your router to nail down the static IP
#linux
Yeah, that's a pain in the ass!
Chicken and egg problem - you need to install packages, but you need to set-up Wi-Fi first.
So first you need to install packages ... by copying them via USB stick.
Remember CD-ROM sneakernet? =)
Also making Wi-Fi robust to reboots is a pain.
This guides worked for me on Ubuntu 18.04.3 server:
- https://www.linuxbabe.com/command-line/ubuntu-server-16-04-wifi-wpa-supplicant
-
rc.local
worked instead of systemd
or crontab
for me https://gist.github.com/mohamadaliakbari/1cb9400984094541581fff07143e1c9d- better use your router to nail down the static IP
#linux
LinuxBabe
Using WPA_Supplicant to Connect to WPA2 Wi-fi from Terminal on Ubuntu 16.04 Server
In this tutorial, we are going to learn how to connect to Wi-fi network from the command line on Ubuntu 16.04 server and desktop using wpa_supplicant.
Ubuntu Snap Strings Attached
Ubuntu has its play store ... and when you install Ubuntu 20 server from scratch ... it offers you to pre-install Docker.
Do not do it. It comes with some app armor bs, which prevents you from using docker-compose and glitches with nvidia-docker.
Canonical forcing their app store too much, selling out or it is just early stage? I do not know. But their app store sucks compared to apt.
#linux
Ubuntu has its play store ... and when you install Ubuntu 20 server from scratch ... it offers you to pre-install Docker.
Do not do it. It comes with some app armor bs, which prevents you from using docker-compose and glitches with nvidia-docker.
Canonical forcing their app store too much, selling out or it is just early stage? I do not know. But their app store sucks compared to apt.
#linux
Downloading via SOCKS 5 Proxy With Wget
Afaik,
No problem, you can use
#linux
Afaik,
wget
supports only HTTP proxies. aria2c
also does not support socks.No problem, you can use
socksify
:sudo apt-get install dante-clientYet another linux magic trick!
SOCKS_USERNAME="user" SOCKS_PASSWORD="password" SOCKS_SERVER="11.111.11.11:1080" socksify wget -c url
#linux
VPN Landscape Changes
There used to be only 2 types of popular VPN services:
1. Self-hosted Open VPN (which is VERY painful to setup) from scratch
2. Using "middlemen" who even overtook YouTube with their sponsored ads. It was so noxious, that everyone was joking about it
But the time showed that there were huge security breaches with some of these "experts" ... and look, these are marketing people, who are basically re-selling you Open VPN at 10x the cost. If it is not enough - they would just sell or lose your data. There is NO INCENTIVE for them to care, as famously quoted.
What has changed lately:
- Wireguard appeared. Supposedly it is much easier to install by yourself. Did not try it myself. Please report your experience
- Enterprise OSS tools like pritunl still exist, which are basically enterprise wrappers around Open VPN and Wireguard. Their docs become more and more convoluted and enterprise focused, but I guess it still works. Key advantage - it is fully OSS and kind of independent (cannot fully check it)
- Open VPN itself ... wrote a "pritunl"-like app called OpenVPN Access Server (great name by the way), and now it is offered by major hosting providers as a bundled app at the price of hosting (DO, Vultr, Hetzner, but Hetzner is not fully bundled). I may be wrong here, but they learned their mistake and made this app not OSS.
What would I choose, if I were to make a choice now? I guess Wireguard or Pritunl.
What do you think?
#linux
There used to be only 2 types of popular VPN services:
1. Self-hosted Open VPN (which is VERY painful to setup) from scratch
2. Using "middlemen" who even overtook YouTube with their sponsored ads. It was so noxious, that everyone was joking about it
But the time showed that there were huge security breaches with some of these "experts" ... and look, these are marketing people, who are basically re-selling you Open VPN at 10x the cost. If it is not enough - they would just sell or lose your data. There is NO INCENTIVE for them to care, as famously quoted.
What has changed lately:
- Wireguard appeared. Supposedly it is much easier to install by yourself. Did not try it myself. Please report your experience
- Enterprise OSS tools like pritunl still exist, which are basically enterprise wrappers around Open VPN and Wireguard. Their docs become more and more convoluted and enterprise focused, but I guess it still works. Key advantage - it is fully OSS and kind of independent (cannot fully check it)
- Open VPN itself ... wrote a "pritunl"-like app called OpenVPN Access Server (great name by the way), and now it is offered by major hosting providers as a bundled app at the price of hosting (DO, Vultr, Hetzner, but Hetzner is not fully bundled). I may be wrong here, but they learned their mistake and made this app not OSS.
What would I choose, if I were to make a choice now? I guess Wireguard or Pritunl.
What do you think?
#linux
Malwarebytes
21 million free VPN users’ data exposed
Recent VPN data leaks and breaches highlight the importance—and difficulty—of fully trusting a VPN provider. Here are tips on who to trust.