Skip to content

Instantly share code, notes, and snippets.

@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 / main.kt
Created October 10, 2023 17:42
Android SDK issue
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import android.content.Intent
import com.nium.pushprovisioningsdk.sdk.NiumPushPay
import com.google.android.gms.tapandpay.TapAndPay
class MainActivity: FlutterActivity() {
@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
@tonis2
tonis2 / gist:72c334f19c38753df0d0cc0864ec72b1
Created April 23, 2019 23:06
Detect website url changes
/* These are the modifications: */
history.pushState = (f =>
function pushState() {
var ret = f.apply(this, arguments)
window.dispatchEvent(new Event("pushState"))
window.dispatchEvent(new Event("locationchange"))
return ret
})(history.pushState)
history.replaceState = (f =>
@tonis2
tonis2 / proxy.js
Last active February 27, 2019 09:13
ES6 light version of Object observing + easy to listen state change
export default class Observer {
constructor(data) {
this.listeners = []
this.preproxy = new WeakMap()
this.state = this.proxify(data, [])
}
listen(callback) {
this.listeners.push(callback)