Skip to content

Instantly share code, notes, and snippets.

View joshleecreates's full-sized avatar

Josh Lee joshleecreates

View GitHub Profile
@joshleecreates
joshleecreates / clickhouse-old-version-migration.sh
Created May 5, 2025 14:15
Migrates schema and tables one-by-one, for moving from a cluster with an older version of CH
#!/bin/bash
table='...'
database='...'
local='...' # clickhouse host - name/IP
remote='...' # clickhouse host - name/IP
CH="clickhouse-client" # you may add auth here
settings="
max_insert_threads=20, # tune threads and block sizes if needed
max_threads=20,
@joshleecreates
joshleecreates / picluster.md
Created February 26, 2025 20:47
Raspberry Pi Cluster with ClickHouse and K3s Setup Steps

Step 1: Setup the Raspberry Pis

  1. Install Raspbian Lite on an SD Card
  2. Boot the Pi
  3. Copy the disk to the NVMe:
sudo dd if=/dev/mm** of=/dev/nvme** bs=32M
  1. Shutdown, remove the SD Card, and reboot
  2. Change the pi hostname to something unique
version: '3.8'
name: coroot
volumes:
prometheus_data: {}
clickhouse_data: {}
clickhouse_logs: {}
coroot_data: {}
node_agent_data: {}
@joshleecreates
joshleecreates / vm-profile.nix
Last active May 24, 2025 15:46
NixOS VM Profile
{ config, pkgs, modulesPath, lib, system, ... }:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
config = {
#Provide a default hostname
networking.hostName = lib.mkDefault "base";
def process_url(url) do
defaults = %{
thing: "thing1value"
}
uri = URI.parse(url)
params = URI.decode_query(uri.query, defaults) |> URI.encode_query
URI.merge(@base_url, uri.path <> "?" <> params) |> to_string
end
@joshleecreates
joshleecreates / classification_helper.ex
Last active February 7, 2017 04:14
An elixir helper for classifying text
@doc """
Example Usage
```
items = [
%{
name: "thing",
description: "foo bar baz"
},
%{
name: "thing two",