Skip to content

Instantly share code, notes, and snippets.

View n-studio's full-sized avatar

n-studio

View GitHub Profile
@n-studio
n-studio / DEPLOY_WITH_KAMAL_ON_DEDICATED_SERVER.md
Last active April 22, 2024 22:47
Deploy a web app on a dedicated server with Kamal

Warning

This gist is still a draft. At the moment it is not functional: see basecamp/kamal#257

Motivation

Kamal was designed with 1 service = 1 droplet/VPS in mind.
But I'm cheap and I want to be able to deploy multiple demo/poc apps apps on my $20/month dedicated server.
What the hell, I'll even host my private container registry on it.

@n-studio
n-studio / DataUsage.swift
Last active July 12, 2022 00:21
Get data usage with swift
#include <ifaddrs.h>
// http://stackoverflow.com/questions/25626117/how-to-get-ip-address-in-swift
func getIFAddresses() -> [String] {
var addresses = [String]()
// Get list of all interfaces on the local machine:
var ifaddr : UnsafeMutablePointer<ifaddrs> = nil
if getifaddrs(&ifaddr) == 0 {