Skip to content

Instantly share code, notes, and snippets.

@tonis2
tonis2 / math.zig
Created March 31, 2021 10:59
Ziglang linear interpolation
// Linear Interpolation Functions
const std = @import("std");
const math = std.math;
fn lerp(x: f16, y: f16, a: f16) f16 {
return x * (1 - a) + y * a;
}
fn invLerp(x: f16, y: f16, a: f16) f16 {
@tonis2
tonis2 / server.sh
Last active March 11, 2024 17:59
Install linux with portainer
#!/bin/bash
# Install dependencies
apt update -y
apt install docker.io -y
apt install docker-compose -y
systemctl start docker
systemctl enable docker
@tonis2
tonis2 / codesign.sh
Created February 13, 2024 19:10
Code sign a flutter app from command line
export CODESIGN_PASSWORD = "test"
export KEYCHAIN_PATH = "build.keychain"
export CERTIFICATE_ID = "id from find-identity"
export PROFILE_ID = "profile from name from apple dashboard"
export CERITIFICATE_FILE = "Certificates.p12"
### At start load the certificate file to keychain
### Copy .mobileprovision to profiles
### Build flutter ipa without codesign
@tonis2
tonis2 / state.dart
Last active March 17, 2025 12:59
Flutter app state
// CREATE STATE HERE
class Inherited extends InheritedNotifier<AppState> {
const Inherited({required super.child, super.key, required super.notifier});
static AppState? of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<Inherited>()!.notifier;
}
@override
bool updateShouldNotify(InheritedNotifier<AppState> oldState) {