Skip to content

Instantly share code, notes, and snippets.

View tonis2's full-sized avatar
🐼

Tonis tonis2

🐼
View GitHub Profile
{"nodes":[{"type":"PromptNode","uuid":"3a8cfe54-5055-451b-b68c-29459a33c861","label":"Prompt config","offset":{"dx":759.609375,"dy":273.6953125},"size":{"width":500,"height":500},"color":4287349578,"inputs":[{"label":"Extra images","key":null,"color":4294961979},{"label":"Init images","key":null,"color":4294961979}],"outputs":[{"label":"Prompt","key":null,"color":4287349578}],"formInputs":[{"label":"Prompt","type":"textArea","min":64,"max":1024,"width":450,"height":100,"maxLines":10,"minLines":4,"defaultValue":null,"value":"Cat is walking on the street","options":null},{"label":"Negative prompt","type":"textArea","min":64,"max":1024,"width":450,"height":100,"maxLines":10,"minLines":4,"defaultValue":null,"value":"","options":null},{"label":"Sampler","type":"dropdown","min":64,"max":1024,"width":221,"height":60,"maxLines":1,"minLines":1,"defaultValue":"Euler","value":"Euler","options":["Euler","Euler a","Heun","DPM2","DPM++2M","DDIM","LCM"]},{"label":"Scheduler","type":"dropdown","min":64,"max":1024,"width":221
@tonis2
tonis2 / passkey.dart
Created April 21, 2025 17:58
Passkey actions on web, with dart
import 'package:web/web.dart';
register(String username, String email) async {
CredentialCreationOptions options = CredentialCreationOptions(
publicKey: PublicKeyCredentialCreationOptions(
rp: PublicKeyCredentialRpEntity(name: "test", id: "localhost"),
user: PublicKeyCredentialUserEntity(
displayName: username,
name: email,
id: Uint8List.fromList("test_id".codeUnits).toJS,
@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) {
@tonis2
tonis2 / codesign.sh
Last active August 15, 2025 09:24
Code sign a flutter app from command line
#!/bin/sh
export CODESIGN_PASSWORD="parool12"
export KEYCHAIN_PATH="build.keychain"
export CERTIFICATE_ID="d6a0f029-f254-4a0e-b57b-bf8ce0922ea7"
export PROFILE_ID="ClaimSure"
export CERITIFICATE_FILE="Certificates.p12"
export APPLE_UPLOAD_USERNAME="myaccount@mail.com"
export APPLE_UPLOAD_PASSWORD="account_password"
@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 / 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 / help.zig
Last active January 24, 2021 16:56
const std = @import("std");
const print = std.debug.print;
pub const Vec3 = packed struct {
x: u32,
y: u32,
z: u32,
pub fn new(x: u32, y: u32, z: u32) Vec3 {
return Vec3{
@tonis2
tonis2 / Caddy_Digitalocean.md
Created October 1, 2020 15:43
How to install Caddy on Linux 20.04 at Digitalocean
@tonis2
tonis2 / gist:a689d9d55ceadc55a23158a102f9fb8e
Created June 4, 2019 06:49
Async websocket calls with ES6
const marker = () => {
return Math.random()
.toString(36)
.slice(2)
.padStart(10, "0")
}
export default class AsyncSocket {
constructor(url = null, config = {}) {
this.url = url
sudo apt-get install libxi-dev libglfw3-dev libglfw3