Skip to content

Instantly share code, notes, and snippets.

View xlab's full-sized avatar
:octocat:
Hacking

Max Kupriianov xlab

:octocat:
Hacking
View GitHub Profile
@xlab
xlab / stage1.toml
Created August 3, 2025 05:28
Rust (riscv64gc-unknown-linux-musl) cross-compile stages (Alpine Musl RISCV64)
change-id = "ignore"
[llvm]
targets = "X86;RISCV"
optimize = true
download-ci-llvm = false
link-shared = false
[build]
target = ["riscv64gc-unknown-linux-musl"]

Survey of available implementations for using Gemma 3n on local devices.

In the pursue to make an impactful app that uses Gemma 3n model, recently published by Google, I have been looking for available implementations for using Gemma 3n on local consumer devices, such as your regular iPhone and Android phones, maybe macOS and even Windows-based laptops.

Gemma 3n is a multi-modal model that can process text, images, and audio. See overview https://ai.google.dev/gemma/docs/gemma-3n

This is a very beginning of hackathon, so the open-source implementations available today are limited to those that google pushed to the public just days before the release. The vest survey so far was published on Hugging Face, see https://huggingface.co/blog/gemma3n

It says "Gemma 3n fully available in the open-source ecosystem", but definition of "fully" is blurry as the multi-modal context is very complicated topic and the designs of some ecosystem toolings are not even ready to accept such "multi" context to begin with. Le

<!DOCTYPE html>
<html>
<head>
<title>Starship Shards</title>
<!-- Original code https://x.com/XorDev/status/1880344887033569682 -->
<!-- https://x.com/xlab_gg Asked Claude 3.5 to convert it to GLSL ES -->
<!-- Attribute original code to @XorDev if you reuse this code -->
<!-- Jan 17, 2025 -->

Cosmos Daemon

Examples of bootstraping Cosmos networks:

$ CHAIN_ID=888 DENOM=inj ./test/cosmos/multinode.sh injectived
$ CHAIN_ID=somm DENOM=samoleans STAKE_DENOM=stake SCALE_FACTOR=000000 ./test/cosmos/multinode.sh sommelier

Full list of the supported ENV variables:

  • CHAIN_ID - specifies Cosmos Chain ID, like cosmos-1
executing transaction
transaction: {
"Salt": 1587842612,
"ExpirationTimeSeconds": 1588447418,
"GasPrice": 6000000000,
"SignerAddress": "0x6ecbe1db9ef729cbe972c83fb886247691fb6beb",
"Data": null
}
transaction data: "0x9694a402000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a63100000000000000000000000000000000000000000000000000000000000000000000000000000000000000005409ed021d9299bf6814279a6a1411a7e866a6310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001158e460913d000000000000000000000000000000000000000000000000000001bc16d674ec8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@xlab
xlab / AUSD.sol
Last active February 6, 2019 23:40
pragma solidity ^0.5.1;
interface TokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external;
}
contract ERC20Interface {
function totalSupply() public view returns (uint256);
@xlab
xlab / CryptoUtils.js
Created July 13, 2018 03:16 — forked from nakov/CryptoUtils.js
JS Crypto Utils - secp256k1 EC cryptography and blockchain functions
const CryptoJS = require("crypto-js");
const EC = require('elliptic').ec;
const secp256k1 = new EC('secp256k1');
function publicKeyToAddress(pubKey) {
let address = CryptoJS.RIPEMD160(pubKey).toString();
return address;
}
function privateKeyToPublicKey(privKey) {
@xlab
xlab / rc2.md
Last active June 29, 2018 10:05

Atlant announces 1.0.0-rc2 node release

This is a bugfix release that resolves node performance issues and adds new supported platforms.

DB growth issue

The major bug that is closed within this release was about internal state DB growth. For our key-value store we use a 3rd-party component called BadgerDB (https://github.com/dgraph-io/badger/) and at the moment of our initial release it had a flaw, that wasn't properly documented. Since our release they improved that part in their codebase and added guidelines in the documentation, we followed these guidelines and now the issue is closed.

The issue with DB growth had the most effect on our testnet nodes, some of them became unresponsive and failed to sync with new clients. We strongly recommend anyone who tested the node to update the executable and restart the sync.

@xlab
xlab / deps.go
Created December 26, 2017 00:18
Collect Go package dependency file tree (an overkilled version with multiple packages per file).
package main
func findDeps(p *build.Package, includes, excludes []string, debug bool) (map[string]map[string]struct{}, error) {
excludeRxs, err := compileRxs(excludes)
if err != nil {
return nil, err
}
deps := make(map[string]map[string]struct{}, len(p.Imports))
addDeps := func(parent, dep *build.Package) {
if !containsPrefix(dep.ImportPath, includes) {
/* Copyright (C) 1989-2014 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,