Skip to content

Instantly share code, notes, and snippets.

View kgn's full-sized avatar

David Keegan kgn

View GitHub Profile
enum Food: String {
case beef = "Beef"
case chicken = "Chicken"
case vegitarian = "Vegitarian"
case kids = "Kids"
}
protocol People {
var people: [Person] { get }
}
@kgn
kgn / svg2png.js
Created September 21, 2021 14:33
const svg2img = require('svg2img');
module.exports = (req, res) => {
svg2img(req.query.url, {width: req.query.width, height: req.query.height, preserveAspectRatio: true},
function(error, buffer) {
if (buffer) {
res.send(buffer);
}
});
};
@kgn
kgn / svg2png
Created October 12, 2021 04:32
Convert svg to png
import svg2img from 'svg2img';
module.exports = (req, res) => {
const url = req.query.url;
const width = req.query.width;
const height = req.query.height;
const size = Math.min(width, height);
svg2img(url, {width: size, height: size, preserveAspectRatio: true},
function(error, buffer) {
if (buffer) {
@kgn
kgn / s3upload.swift
Created January 28, 2022 05:57
Simple function to upload files to S3 in Swift with no dependencies
import Foundation
import CryptoKit
extension String {
func hmac(key: String) -> String {
let secret = key.data(using: .utf8)!
let message = self.data(using: .utf8)!
var hmac = HMAC<Insecure.SHA1>(key: SymmetricKey(data: secret))
hmac.update(data: message)
#!/bin/bash
#########################################################################################
# Ollama + Chatbox + DeepSeek Installation & Configuration Script
#
# This script:
# - Deploys Ollama and ensures it's configured for remote access
# - Moves Ollama storage to /data (if needed) to optimize space
# - Installs NVIDIA drivers, CUDA, and configures GPU usage
# - Verifies CUDA and VRAM availability
# - Configures UFW to allow external access