Skip to content

Instantly share code, notes, and snippets.

@nisanthchunduru
nisanthchunduru / my-kamal-1-to-2-upgrade-experience.md
Last active May 18, 2026 09:37
My Kamal 1 to my Kamar 2 experience

My experience upgrading from kamal 1 to kamal 2

Since kamal 1 launched, I hosted my blog https://nisanthchunduru.com/ in a Cloud VM using kamal 1. kamal deploys a project to Docker containers in 1 or more servers.

In Q3 2024, Basecamp launched kamal 2. kamal 2 is slightly backwards incompatible with kamal 1.

When a kamal command I ran unexpectly failed, I decided to just upgrade my blog to kamal 2 (instead of investing time to investigate a failure in an older kamal version).

To upgrade to kamal 2, I

@nisanthchunduru
nisanthchunduru / logo.svg
Created March 14, 2026 22:34
Logo (Draft)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
kamal deploy
Log into image registry...
INFO [43ba0482] Running docker --version && docker buildx version as chunisan@localhost
INFO [43ba0482] Finished in 0.263 seconds with exit status 0 (successful).
INFO [78be9720] Running docker login -u [REDACTED] -p [REDACTED] as chunisan@localhost
INFO [78be9720] Finished in 3.187 seconds with exit status 0 (successful).
INFO [335cb57f] Running docker login -u [REDACTED] -p [REDACTED] on 150.136.2.200
INFO [335cb57f] Finished in 3.772 seconds with exit status 0 (successful).
Build and push app image...
INFO [57fe232e] Running docker --version && docker buildx version as chunisan@localhost
// TODO: Migrate to AWS Node SDK V3
const AWS = require('aws-sdk');
const cloudformation = new AWS.CloudFormation()async function disableTerminationProtection(stackNames) {
for (const stackName of stackNames) {
try {
await cloudformation.updateTerminationProtection({
EnableTerminationProtection: false,
StackName: stackName,
}).promise();
console.log(`Termination protection disabled for stack ${stackName}`);
@nisanthchunduru
nisanthchunduru / neural_network.py
Created November 13, 2023 10:18
Simple Neutral Network from scratch
# This program was generated by ChatGPT
import numpy as np
# Sigmoid activation function
def sigmoid(x):
return 1 / (1 + np.exp(-x))
# Derivative of the sigmoid function
def sigmoid_derivative(x):
@nisanthchunduru
nisanthchunduru / application.rb
Created June 26, 2023 12:44
Log responses in Rails in development environment
# In config/application.rb
class ResponseLogger
def initialize(app)
@app = app
end
def call(env)
headers = env.select {|k,v| k.start_with? 'HTTP_'}
.map {|pair| [pair[0].sub(/^HTTP_/, ''), pair[1]].join(": ")}
@nisanthchunduru
nisanthchunduru / teach_web_dev.md
Last active May 17, 2023 01:56
Teach web dev

Structs & functions

#include <stdio.h>
#include <string.h>

int stringsTotalLength(char* firstString, char* secondString) {
  int totalLength = strlen(firstString) + strlen(secondString);
  return totalLength;
}
@nisanthchunduru
nisanthchunduru / gist:d341ab22dede19e572d0e8152393e93a
Created June 8, 2021 13:40 — forked from ryanbriones/gist:246599
send email to gmail (STARTTLS) using ruby >=1.8.7
# send email using STARTTLS; Net::SMTP#enable_starttls requires ruby >=1.8.7
# this hack is needed for rails <2.3; apparently >=2.3 has something for this already
ActionMailer::Base.class_eval do
private
def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
@nisanthchunduru
nisanthchunduru / redis-server
Last active March 7, 2019 13:26
Redis init script
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@nisanthchunduru
nisanthchunduru / bounce_events.rb
Last active October 31, 2018 14:09
Missing "smtp_id" key
{
"_json" => [{
"email" => "lovis@tinybuddy.se",
"timestamp" => 1540907117,
"status" => "4.3.0",
"reason" => "maildrop: maildir over quota.",
"sg_message_id" => "kxRB0RumSp6z8tkmLZnUMQ.filter0176p3mdw1-22850-5BD1C50F-7C.0",
"sg_event_id" => "QcLgvoOaRWCXLZ72J-lf1g",
"type" => "blocked",
"event" => "bounce"