LLMs and an old dev

A lot of developers seem to be afraid of generative AI and LLMs because it may replace their jobs. But as an older developer who sometimes has a hard time keeping up with new frameworks and technologies, LLMs have been life-saving. Not only is my productivity high, but I am also able to keep up with new languages and codebases and be productive almost immediately. I used to think about moving to management because it seemed I could not keep up with tech, but now I have new confidence that I can keep doing my hobby as a profession for another few years. ...

June 10, 2025 · 1 min · Amer Khalid

Backup VPS

Here are simple steps to backup your VPS. Backup MySQL database Create a directory to store the backup files. Then run mysqldump command to backup your database. mysqldump -u your_mysql_user -pyour_mysql_password your_database_name > /path/to/dump_$(date +\%Y\%m\%d\%H\%M\%S).sql Or you run it as superuser and backup all databases at once. sudo mysqldump --all-databases > /path/to/dump_$(date +\%Y\%m\%d\%H\%M\%S).sql To automate this, schedule a cron job that will run this command on a daily basis. crontab -e Insert the following line to execute the mysqldump command every day at midnight. ...

September 10, 2023 · 1 min · Amer Khalid

A quick script to build and deploy hugo site on VPS

I had been using GitHub and Netlify for this site but lack of some features such as access to server logs finally got too much. So I decided to move this blog to my VPS. One thing I really love about using Github is CI/CD and Github Actions. But I wanted something even simpler with less dependencies. So I decided to use a simple bash script to build and deploy the site. ...

September 6, 2023 · 2 min · Amer Khalid

undefined method xxxxx' for #< Hash:0x00000 >

This error in our Rails application drove me crazy. The error was like this: undefined method xxxxxx' for #<Hash:0x000000001234> The problem was that I was calling a method like this: a_method(var: var) And the method definition was like def a_method(var: var) which resulted in something called variable shadowing and caused clash between variable passed in the method and local variable being defined. The fix was to change method definition to def a_method(var:) ...

June 14, 2023 · 1 min · Amer Khalid

Script inherits from native type 'RigidBody2D', so it can't be assigned to an object of type: 'Node2D'

Getting this error while following this tutorial in Godot v4.0.1. In my case, I had added Node2D. The fix was to right-click on the problem node under Scene and click Make Scene Root. And then delete Node2D. Here is what diff looked like: diff --git a/2d-game-tutorial/Mob.tscn b/2d-game-tutorial/Mob.tscn index 9eb1630..e720d7f 100644 --- a/2d-game-tutorial/Mob.tscn +++ b/2d-game-tutorial/Mob.tscn @@ -48,20 +48,18 @@ animations = { radius = 36.0 height = 100.0 -node name="Mob" type="Node2D"] -script = ExtResource("1_73gb4") - -node name="RigidBody2D" type="RigidBody2D" parent="."] +node name="RigidBody2D" type="RigidBody2D"] collision_mask = 0 gravity_scale = 2.66454e-15 +script = ExtResource("1_73gb4") -node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="RigidBody2D"] +node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] scale = Vector2(0.75, 0.75) sprite_frames = SubResource("SpriteFrames_c1yjy") animation = &"walk" -node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +node name="CollisionShape2D" type="CollisionShape2D" parent="."] rotation = 1.5708 shape = SubResource("CapsuleShape2D_h1pjc") -node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="RigidBody2D"] +node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]

April 28, 2023 · 1 min · Amer Khalid

How much can you really get out of a 4$ VPS?

I am a big fan of cheap VPSs. I start many personal projects, bring up a VPS, play around and then wipe it. Never have to worry about accidentally running up a bill in 100s or 1000s of dollars. I run this blog on a $4 server. So this was interesting to read how far can a cheap VPS go.

February 6, 2023 · 1 min · Amer Khalid

How to backup Kubernetes' Config

The easiest solution seems to be the following script by Stack Overflow user, Timothy Perez : <pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">#!/bin/bash # NAMESPACED EXPORTS for ns in $( kubectl get ns --no-headers | cut -d " " -f1 ) ; do kubectl --namespace = " ${ ns} " get -o = json bindings,cm,ep,ev,limits,pvc,po,podtemplates,rc,quota,secrets,sa,svc,controllerrevisions,ds,deploy,rs,sts,localsubjectaccessreviews,hpa,cj,jobs,leases,ev,ds,deploy,ing,netpol,rs,pods,netpol,pdb,roles,rolebindings | \ jq '.items[] | select(.type!="kubernetes.io/service-account-token") | del( .spec.clusterIP, .metadata.uid, .metadata.selfLink, .metadata.resourceVersion, .metadata.creationTimestamp, .metadata.generation, .status, .spec.template.spec.securityContext, .spec.template.spec.dnsPolicy, .spec.template.spec.terminationGracePeriodSeconds, .spec.template.spec.restartPolicy )' >> "./ ${ ns} .json" done # NON-NAMESPACED EXPORTS kubectl get -o = json cs,ns,no,pv,mutatingwebhookconfigurations,validatingwebhookconfigurations,crds,apiservices,tokenreviews,selfsubjectaccessreviews,selfsubjectrulesreviews,subjectaccessreviews,csr,psp,nodes,psp,clusterrolebindings,clusterroles,pc,sc,volumeattachments | \ jq '.items[] | select(.type!="kubernetes.io/service-account-token") | del( .spec.clusterIP, .metadata.uid, .metadata.selfLink, .metadata.resourceVersion, .metadata.creationTimestamp, .metadata.generation, .status, .spec.template.spec.securityContext, .spec.template.spec.dnsPolicy, .spec.template.spec.terminationGracePeriodSeconds, .spec.template.spec.restartPolicy )' >> "./cluster_non-namespaced_export.json" Script copied here under CC BY-SA 4.0 license ...

January 20, 2022 · 1 min · Amer Khalid

Kubernetes not passing full path to Nodejs

I spent hours troubleshooting why the url path was getting stripped from requests in our Nodejs/Expressjs based app. The reason was this line in Kubernetes’ Ingress: nginx.ingress.kubernetes.io/rewrite-target : / Removing it fixed the issue. Check the Kubernetes documentation for more details.

December 29, 2021 · 1 min · Amer Khalid

Ask HN: Software Engineer hitting 40: what's next?

Recent thread on Hacker News, https://news.ycombinator.com/item?id=29360119, was very interesting for me especially since I turned 40 this year. Programming is something I enjoy and am pretty good at it. I’m still not at the top of the salary range for programmers but this is a tough question. I can get into FAANG but there is still a ceiling of how much one can earn as a software engineer. This comment says it best: ...

December 1, 2021 · 1 min · Amer Khalid

Wealth Lab Pro Earning Play Screener

This is a quick script that I use to find options to buy or sell. using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Components; namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { DataSeries maFast = EMAModern.Series(Close, 50 ); DataSeries maSlow = EMAModern.Series(Close, 200 ); DataSeries maFast_1 = EMAModern.Series(Close, 10 ); DataSeries maSlow_2 = EMAModern.Series(Close, 50 ); DataSeries ma = EMAModern.Series(Close, 10 ); DataSeries maFast_3 = EMAModern.Series(Close, 10 ); DataSeries maSlow_4 = EMAModern.Series(Close, 50 ); PlotSeries(PricePane,EMAModern.Series(Close, 50 ),Color.Red,LineStyle.Solid, 2 ); PlotSeries(PricePane,EMAModern.Series(Close, 200 ),Color.Green,LineStyle.Solid, 2 ); PlotSeries(PricePane,EMAModern.Series(Close, 10 ),Color.Blue,LineStyle.Solid, 2 ); PlotSeries(PricePane,EMAModern.Series(Close, 50 ),Color.Red,LineStyle.Solid, 2 ); PlotSeries(PricePane,EMAModern.Series(Close, 10 ),Color.Blue,LineStyle.Solid, 2 ); //for(int bar = GetTradingLoopStartBar(201); bar < Bars.Count; bar++) int bar = Bars.Count - 1 ; { if (IsLastPositionActive) { Position p = LastPosition; if (p.EntrySignal.Contains("Group1|" )) { if (CrossUnder(bar, maFast_3, maSlow_4)) { SellAtMarket(bar + 1 , p, "Group1" ); } } } else { if (maFast[bar] > maSlow[bar]) { if (maFast_1[bar] > maSlow_2[bar]) { if (Close[bar] < ma[bar]) { if (EarningsDate.InWindow( this , bar, "earnings per share" , 7 , 0 )) { BuyAtMarket(bar + 1 , "Group1|" ); } } } } } } } } }

September 29, 2021 · 1 min · Amer Khalid