Spark in me
2.26K subscribers
752 photos
48 videos
114 files
2.64K links
Lost like tears in rain. DS, ML, a bit of philosophy and math. No bs or ads.
Download Telegram
Untar all the archives in the folder, deleting them

find . -name '*.tar' -execdir tar -xvf '{}' \; -execdir rm '{}' \;

#linux
Python3 nvidia driver bindings in glances

They used to have only python2 ones.

If you update your drivers and glances, you will get a nice GPU memory / load indicator within glances.
So convenient.

#linux
Getting your public key from Github ... with wget!

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:

USER="YOUR_USER" && \
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
#linux
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
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:
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
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
Tricky rsync flags

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
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 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 line

Now 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
- 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
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
Downloading via SOCKS 5 Proxy With Wget

Afaik, wget supports only HTTP proxies. aria2c also does not support socks.

No problem, you can use socksify:

sudo apt-get install dante-client
SOCKS_USERNAME="user" SOCKS_PASSWORD="password" SOCKS_SERVER="11.111.11.11:1080" socksify wget -c url

Yet another linux magic trick!

#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