Skip to content

Instantly share code, notes, and snippets.

View tonidy's full-sized avatar

toni dy tonidy

View GitHub Profile
@tonidy
tonidy / k0s.sh
Created February 18, 2025 15:15
k0s
#!/bin/sh set -e if [ -n "${DEBUG}" ]; then set -x fi _k0s_latest() { curl -sSLf "https://docs.k0sproject.io/stable.txt" } _detect_binary() { os="$(uname)" case "$os" in Linux) echo "k0s" ;; *) echo "Unsupported operating system: $os" 1>&2; return 1 ;; esac unset os } _detect_arch() { arch="$(uname -m)" case "$arch" in amd64|x86_64) echo "amd64" ;; arm64|aarch64) echo "arm64" ;; armv7l|armv8l|arm) echo "arm" ;; *) echo "Unsupported processor architecture: $arch" 1>&2; return 1 ;; esac unset arch } _download_url() { echo "https://github.com/k0sproject/k0s/releases/download/$K0S_VERSION/$k0sBinary-$K0S_VERSION-$k0sArch" } main() { if [ -z "${K0S_VERSION}" ]; then K0S_VERSION=$(_k0s_latest) fi k0sInstallPath=/usr/local/bin k0sBinary="$(_detect_binary)" k0sArch="$(_detect_arch)" k0sDownloadUrl="$(_download_url)" mkdir -p -- "$k0sInstallPath" echo "Downloading k0s from URL: $k0sDownloadUrl" curl -sSLf "$k0sDownloadUrl" >"$k0sInstallPath/$k0sBinary" chmod 755 -- "$k0sInstallPath/$k0sBinary" echo "k0s is now executa
@tonidy
tonidy / docker-compose.yml
Last active February 18, 2025 14:15
Playit Docker Compose Service
services:
playit:
image: ghcr.io/playit-cloud/playit-agent:0.15
network_mode: host
restart: always
environment:
- SECRET_KEY=abcde
@tonidy
tonidy / install-libomp.md
Last active December 5, 2024 10:38
Applied fix to provide universal OpenMP binary

The problem is if cmake can only link with the x86_64 OpenMP but not the arm64 OpenMP, it would report Could NOT find OpenMP_C

So this issue won't exists if:

  • cmake can report which architecture cannot be linked
  • homebrew provides universal binary

Reference:

class YamlCpp < Formula
desc "C++ YAML parser and emitter for YAML 1.2 spec"
homepage "https://github.com/jbeder/yaml-cpp"
url "https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz"
sha256 "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16"
license "MIT"
bottle do
sha256 cellar: :any, arm64_sequoia: "b453cb98bf2c4dc253c3523f587a0af606e5a682bcd7b7bd0f69013e95cfe418"
sha256 cellar: :any, arm64_sonoma: "778720c980df7e2e5ed7a971eea721ecd6a21069f927279809496164c3248f69"
@tonidy
tonidy / install.md
Last active February 12, 2025 07:55
Run Deno in .NET Interactive
@tonidy
tonidy / gist:4ac57e4538c78acd38372c367ec0df0e
Created September 14, 2024 11:43
Log after connected to gonb
2024-09-13T17:08:51.9746120Z [00-a1b958cb466a2e7e8ffc1e3887df7429-6b8b98cd6f3067e7-00] [KernelInvocationContext] [KernelInvocationContext] ▶ +[ ⁞Ϲ⁞ SubmitCode #!connect jupyter --help (Token: 2OrVnNbLSO28kad/YNNmMg==, TargetKernelName: csharp, DestinationUri: ) ]
2024-09-13T17:08:51.9750460Z [00-a1b958cb466a2e7e8ffc1e3887df7429-c559b98a211c5d3f-00] [KernelScheduler] [Run] ▶ +[ ⁞Ϲ⁞ DirectiveCommand (Token: 2OrVnNbLSO28kad/YNNmMg==.1, TargetKernelName: csharp, DestinationUri: ) ]
2024-09-13T17:08:51.9751390Z [00-a1b958cb466a2e7e8ffc1e3887df7429-c559b98a211c5d3f-00] ℹ ➡️ DirectiveCommand kernel://pid-77815/ (arrived)
2024-09-13T17:08:51.9751660Z [00-a1b958cb466a2e7e8ffc1e3887df7429-c559b98a211c5d3f-00] ℹ ➡️ DirectiveCommand kernel://pid-77815/csharp (arrived)
2024-09-13T17:08:51.9757320Z [00-a1b958cb466a2e7e8ffc1e3887df7429-c559b98a211c5d3f-00] ℹ ⁞Ε⁞ StandardOutputValueProduced '' (FormattedValues: 'Description: ...' (text/plain)) (ValueId: ) (Command: SubmitCode, Token: 2OrVnNbLSO28kad/YNNmMg==)
20
error[E0277]: the trait bound `AnalysedType: wasm_wave::wasm::WasmType` is not satisfied
--> /Users/toni/.cargo/registry/src/index.crates.io-6f17d22bba15001f/golem-wasm-rpc-0.0.26/src/text.rs:7:17
|
7 | type Type = AnalysedType;
| ^^^^^^^^^^^^ the trait `wasm_wave::wasm::WasmType` is not implemented for `AnalysedType`
|
= help: the following other types implement trait `wasm_wave::wasm::WasmType`:
wasm_wave::value::Type
wasmtime::ValType
wasmtime::component::Type
@tonidy
tonidy / create_authors.sql
Created December 18, 2022 07:31
Library Database
DROP TABLE IF EXISTS `authors`;
CREATE TABLE `authors` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(32) DEFAULT NULL,
`birthday` date DEFAULT NULL,
`address` text DEFAULT NULL,
`phone_number` char(13) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
address=/.test/127.0.0.1
address=/.dev/127.0.0.1
#listen-address=127.0.0.1
@tonidy
tonidy / 0x0.sh
Created October 22, 2022 09:04 — forked from gingerbeardman/0x0.sh
Simple cli tool to use https://0x0.st for ephemeral file uploads. Install: curl https://gist.githubusercontent.com/gingerbeardman/5398a5feee9fa1e157b827d245678ae3/raw/9ea5c714b41bdef77a8984bc91ff5d248c48d048/0x0.sh | sudo tee /usr/local/bin/0x0.sh && sudo chmod +x /usr/local/bin/0x0.sh
#!/bin/sh
URL="https://0x0.st"
if [ $# -eq 0 ]; then
echo "Usage: 0x0.st FILE\n"
exit 1
fi
FILE=$1