Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev) profile picture

Fractional CTO. Getting things done myself or via others. AI, GenAI, teamwork, CI/CD, as well as Web Development, mostly JavaScript, React, Node and .NET Core

Toronto, Canada
Joined July 2020
Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)Photo by Nick Taranov 🇨🇦 | Fractional CTO (@Red_Pill_Dev)
Nick Taranov 🇨🇦 | Fractional CTO retweeted
When it’s a word pattern matcher, it’s a word pattern matcher. You might think it’s intelligence, but it’s a word pattern matcher. It’s not a belittlement. It’s just what it is.
236
450
80
7,728
489,670
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Choose a career in programming 😁👌🏻
20
53
4
491
14,695
Nick Taranov 🇨🇦 | Fractional CTO retweeted
A major blocker to free and open source multimedia is @isostandards. ISO standards are behind an expensive paywall, making them impossible to access for volunteer developers in FFmpeg, or anyone wanting to learn about multimedia technology
107
974
82
8,448
388,252
Nick Taranov 🇨🇦 | Fractional CTO retweeted
HTML fits right in 😹
33
52
4
905
30,198
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Breathtaking Footage of Earth Rising Over the Moon, Captured by Japan's Kaguya Lunar Orbiter
495
2,554
227
14,511
638,167
Nick Taranov 🇨🇦 | Fractional CTO retweeted
TSMC has achieved early production yields at its first plant in Arizona that surpass similar factories in Taiwan, a significant breakthrough for a US expansion project initially dogged by delays and worker strife trib.al/c6XdKvH
292
1,953
1,240
14,055
4,746,639
Nick Taranov 🇨🇦 | Fractional CTO retweeted
What the night sky on Mars may look like...
190
1,514
103
9,417
317,448
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Mars...
110
756
35
5,174
130,264
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Extremely detailed view of Mars🤯
169
1,107
63
6,945
226,969
Nick Taranov 🇨🇦 | Fractional CTO retweeted
We all heard those stories. Netlify billed someone $104k for a static website. Cara got $96,280 bill from Vercel after going viral. You want to be an indie-hacker, not an indie-bankrupt. What if I tell you that a $5 VPS can serve 5K RPS? Here is how you can set it up yourself: (these steps are obviously more involved than just clicking a couple of buttons in Vercel, but they give you something no PaaS can ever do: ownership of your infrastructure and independence. Choose wisely!) 1. Selecting a cloud provider There are two groups of cloud providers, the expensive ones with tons of enterprise features (think AWS, GCP, Azure), and the cheap ones (Digital Ocean, Scaleway, Hetzner, Linode, etc), which do not charge ridiculous prices but don't have that many features. Since we only need a VPS, the cheap ones are more than enough. I personally like Hetzner for their low compute and storage prices and 1$/TB of bandwidth costs (with 20TB included for free), but the other are fine too. Pick whatever you like (but if you end up with Hetzner, you can use my referral link to get yourself a free $20 sign-in bonus hetzner.cloud/?ref=Iy1q0kM4D…). 2. Generating an SSH key You need this key to connect to your server via SSH. If you don't have one already, open a terminal on mac or linux (sorry windows folks, you will have to figure this out for yourself) and type ssh-keygen -t ed25519 -C "your_email@example.com" (don't forget to replace your email). You will get two files, id_ed25519 and id_ed25519.pub. id_ed25519 is a private key and it must be kept private, id_ed25519.pub is a public key and you can share it with anyone. In our case, you need to upload your public key to your cloud provider. 3. Create a VPS Now you're ready to create a virtual server. Since I use Hetzner, I create a shared CPU x86 server, use the latest Ubuntu as the OS, select the SSH key I created and uploaded earlier, enable backups and click create. A minute later the server is ready. 4. SSH into the server When the server is ready, you can finally connect to it: ssh root@1.2.3.4 (replace the ip with the ip of your server). Say yes when prompted about trusting the key. If everything went well, you will see a welcome message. 5. Setting up a firewall Let's lock down our server right away. First we check that we have a firewall installed: ufw status. If it is not installed, install it with apt install ufw. Now we're ready to configure the firewall. First, open the port for SSH: ufw allow ssh. Then, deny all incoming connections by default: ufw default deny incoming. We also want to allow outgoing connections: ufw default allow outgoing. Finally, enable the firewall: ufw enable That's it! Now, even if you run a database with ports open to the internet, the firewall will not let anyone access it. 6. Creating a non-root user So far we were working as root. This is dangerous because root has unrestricted access to our server and it is too easy to cause serious damage while working as root. Let's create a new user which we will use to do everything on the server. To do this, create the user with the following command (don't forget to replace <user_name>!): adduser <user_name> You will be asked the password and a bunch of other questions. Only the password is required though, and the rest can be skipped. We also need to give the user the ability to run commands with sudo: usermod -aG sudo <user_name> Done! 7. Setting up ssh access for the new user Because we want to avoid logging in as root, we need to setup ssh for the newly created user: # Switch to the new user su - <user_name> # Create the SSH folder mkdir ~/.ssh # Restrict access to this user only chmod 700 ~/.ssh Now we need to add your public key to the authorized_keys file. Open it with an editor: nano ~/.ssh/authorized_keys Paste the contents of your public SSH key, hit CTRL + X to quit, then Y and enter to save. Confirm that you saved the key by running cat ~/.ssh/authorized_keys. This command should print your public key. Finally, we need to change the permissions on this file too: chmod 600 ~/.ssh/authorized_keys Open a second terminal and ssh into the server with ssh <user_name>@<server_ip>. You should see the Ubuntu welcome message. If not, check the steps again. 8. Disabling ssh root and password login Now we're ready to disable root and password login via ssh. We must do that because using passwords for SSH can be unsafe, since people tend to use weak passwords, and hackers can brute-force them. But the SSH key is impossible to brute-force, and we're going to use it as our main login method. And because we're not going to use root anymore, we will disable the root login as an additional security layer. Be sure to be connected to your server as a newly created user and not root. Let's edit the SSH config: sudo nano /etc/ssh/sshd_config Note that you need sudo as you're not a root anymore, and you will be prompted for your password. Find PermitRootLogin parameter and change its value to no. Do the same for PasswordAuthentication. Make sure to remove any leading # (e.g.: #PasswordAuthentication). Press CTRL + X to quit, then Y and enter to save. To apply the new changes, we need to restart the ssh server: sudo systemctl reload sshd Now, if you try to ssh as root, you should see Permission denied (publickey). 9. Set up automatic security upgrades: To make our server even more secure, we can enable automatic security upgrades. Ubuntu has a package which help us with that. To use it, we need to run the following command: sudo dpkg-reconfigure --priority=low unattended-upgrades To verify that automatic upgrades were enabled you can run the following command: apt-config dump APT::Periodic::Unattended-Upgrade It should output the following: APT::Periodic::Unattended-Upgrade "1"; That's it! Now that the server is relatively secure, let's make our life easier and install tailscale to access it. 11. Installing tailscale Because our firewall setup is very strict (as it should be) and does not allow any incoming connection to any other port than SSH, we now have a problem: how do we access the apps we deploy there? For example, if we deploy coolify, how do we access their dashboard? One way is to do ssh port forwarding, but a better option is to set up a VPN such as tailscale. Tailscale will create a VPN tunnel between your laptop and the server, allowing you to access it as it was on your local network. To install it, the best option is to follow their official tutorial: tailscale.com/kb/1347/instal… After you installed it, you need to adjust the firewall config or otherwise it won't work: sudo ufw allow in on tailscale0 12.1. Setting up coolify (optional) A lot of people like using coolify for deployment of their projects. The benefits are a nice UI, and automatic deploy of your latest changes from github. Again, nothing better than the official tutorial here: coolify.io/docs/introduction 12.2. Setting up systemd (alternative to coolify) If you don't want to use coolify to run your services, you can use systemd for that. Systemd is a linux component which can take care of running and restarting your services. It might be a good option if you use a language which compiles to a single executable and you can avoid docker containers. Let's assume that your application is located at /home/<user_name>/myapp/main To start it automatically and restart on crashes, we need to create a so-called systemd unit. Do the following steps: cd /etc/systemd/system Create a file named your-service.service: sudo nano your-service.service Then add the following inside the file [Unit] # human-readable description Description=myapp # wait for the network to be online before starting the app After=network.target [Service] # the user under which the app will be run User=<user_name> # app working directory WorkingDirectory=/home/<user_name>/myapp # path to the executable ExecStart=/home/<user_name>/myapp/main # always restart the app when it crashes or shuts down Restart=always [Install] WantedBy=multi-user.target Next, we need to enable the newly created unit: sudo systemctl enable your-service.service Now, the systemd unit will take care of restarting the application in case it fails. To deploy on push to main, you will have to set up a github workflow. Here is what I use: gist.github.com/meln1k/d2d10…. It is written for Go, if you use a different language you will have to change it a bit. If you find this too complicated, go with coolify. 10. Setting up nginx as reverse proxy Alright, by this time we have our services set up (either via coolify or systemd) and accessible via the VPN. But how do we expose them on the internet? We need a reverse-proxy which will handle TLS and route the requests to the appropriate service. There a tons of good tutorials on how to configure nginx, so I'm not going to repeat them here. The link below is a good one, and you can follow it up to step 4: digitalocean.com/community/t… Now that you have nginx setup, let's configure it to proxy requests to your service. Assuming that your service is running on http://localhost:3000, you need to do the following: create a nginx configuration file at /etc/nginx/sites-available/yourdomain.com: sudo nano /etc/nginx/sites-available/yourdomain.com Then add the following in the configuration: server { listen 443 ssl; listen [::]:443 ssl; server_name yourdomain.com; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers HIGH:!aNULL:!MD5; location / { proxy_pass http://localhost:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } Now we need to enable the site by creating a symbolic link: sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled/ Let's test that there are no errors in nginx config: sudo nginx -t Finally we can restart nginx: sudo systemctl restart nginx Nginx should be accepting connections on 443, and forwarding them to your service. Time to get the SSL certificates! 11. Setting up let's encrypt To get a SSL cert, we can use let's encrypt. There is a tool called certbot, and it automates the process a lot. I'm not going to copy the official docs and will point you to them instead: certbot.eff.org/instructions… There is a nice post on digital ocean too: digitalocean.com/community/t… digitalocean.com/community/t… And that's it! Now you have a secured server, which performs unattended updates and has SSL configured. The most important is that you have ownership over your infrastructure, and no one can blackmail you to pay more money or they will shut your account. In the worst case, you can create a new VPS at some other provider, migrate your projects there and live a happy life. 12. BONUS: getting 5K RPS on $5 VPS I have to say that at this point it really depends on what kind of tech stack you use. If you use a fast compiled language (e.g. Go or Rust) and a fast database, you can really squeeze the performance out of that small VPS. I personally use Go and SQLite, and my $5 VPS can do 6.5K RPS on authenticated dynamic pages (with user session auth and reading from the database) without much tweaking. Don't forget to enable WAL on SQLite, otherwise the performance will be horrible. As for backups, I use litestream, a tool that replicates SQLite to an S3 compatible storage. That's it folks! Hope you've enjoyed this post!
7
14
3
56
6,859
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Replying to @CFDevelop
I used F# in 2010 for this reason. What happened is that F# came to C# with type inference, LINQ, and pattern matching. Now, there are not so many reasons to switch to F#, and there are many reasons to stay with C#.
1
1
1
138
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Replying to @csaba_kissi
In a 24 hours React class I tough to thousands of students, first 8 hours were literally JavaScript.
1
1
203
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Replying to @rishabincloud
Ok. I have dozens of certs and did a lot of hiring, so listen me out. I'm going to explain how they are important and how they generally "work". 1. Certs don't really prove job skills. 2. They prove that the person knows *something*. 3. This might make a difference for an entry role with other thing being equal. 4. For advanced, non-entry level roles, you have to have some serious skills and be able to demonstrate them. Certificates sometimes still matter. 4.1. You will be able to demonstrate that you are an internally motivated person (except when your experience is a consulting shop where they force people to get certified). 4.2. You will demonstrate that you are somewhat current with the technology, especially for persons working in places like govt or a bank, or just for a long time. 4.3. Older folks can demonstrate that they are somewhat mentally flexible. 5. There are "cert haters" - people who are sour about certs working with "certified" colleagues in the past. Usually, if you don't require them to kneel before awesome certified you, they won't be too irritated. 6. Consulting shops get freebies for certified employees, so it might matter for them. 7. Usually, it's enough to have just 1 (one) top-tier certificate in your line of work. Having dozens (like I do) don't really give you much in a job interview.
1
5
336
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Replying to @Abderraouf_29
Just create 2 posts. 1 - with question. 2 - with a wrong answer under a different account.
1
1
104
Nick Taranov 🇨🇦 | Fractional CTO retweeted
66 years apart
1,089
4,507
749
39,331
88,930,904
Nick Taranov 🇨🇦 | Fractional CTO retweeted
I've never understood the appeal of Tailwind The power of CSS is reusable classes Style once → apply anywhere Modifying a Tailwind style means doing a find and replace on 100s of instances of an HTML object What am I missing?
589
81
83
1,557
706,523
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Replying to @chrisrickard
Hot take! If you feel you are an impostor, you as well might be it. Get better, feel better, keep you job! I read somewhere 40% of people in IT feel it. I mean, c'mon we don't have even close to 40% high performers in IT 😉
1
1
81
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Replying to @csaba_kissi
JavaScript is terrible, horrible, atrocious for beginners. FFS, this is a JIT compiled language with unintuitive runtimes, with the library effectively being stuffed into the language standard. It has ugly legacy, and it's multiparadigm. It's you 3rd language, not even 2nd.
1
2
116
Nick Taranov 🇨🇦 | Fractional CTO retweeted
Hard truth: Some devs are WAY more productive. As a consultant, I work with dozens of teams. I see massive differences in developer output. Here's an example on the same team: Dev 1: 45 PRs/month Dev 2: 1 PR/month I did code reviews. Dev 1 had higher code quality too.
202
118
62
1,979
929,662