Skip to content

Instantly share code, notes, and snippets.

View vgrichina's full-sized avatar

Vladimir Grichina vgrichina

View GitHub Profile
@vgrichina
vgrichina / vibec.md
Last active March 20, 2025 08:50
vibec.md

Vibe Compiler (vibec)

A self-compiling tool to process vibe-coded projects using prompt stacks and LLM generation.

Overview

vibec transforms stacks of prompts into code and tests, supporting static .md and dynamic .js plugins. It outputs staged artifacts (output/stages/) for Git history and a current runtime version (output/current/) aggregated from all stages with a "Last-Wins" strategy. It can compile itself using its own structure.

Project Structure

@vgrichina
vgrichina / minimal-ai-coder.md
Last active March 18, 2025 02:59
minimal-ai-coder.md

Minimalistic AI Coding Assistant

1. ./context - Code Context Generator

Purpose

Generate contextual information from a codebase to send to an LLM.

Arguments

--files=<pattern>        File pattern to include (e.g., "src/*.js")
select
format_timestamp('%m/%d/%Y %H:%M:%S', timestamp_millis(div(block_timestamp, 1000000))) as `Date`,
parse_bignumeric(json_value(args, '$.deposit')) / POW(cast(10 as bignumeric), 24) as `Sent Quantity`,
'NEAR' as `Sent Currency`
, receipt_predecessor_account_id
, receipt_receiver_account_id
from `bigquery-public-data.crypto_near_mainnet_us.receipt_actions`
where receipt_predecessor_account_id in
(
'vlad.near',
@vgrichina
vgrichina / parse-json.c
Last active December 5, 2022 06:49
chatGPT parse json lazy
// Tokenize the JSON string by splitting on `{`, `}`, `[`, and `]`, unless the character is inside a string
char* token = strtok(jsonCopy, "{}[],");
bool inString = false;
int depth = 0;
while (token != NULL) {
if (!inString && depth == 0 && strcmp(token, path) == 0) {
// The requested path was found, so return the next token as the value
token = strtok(NULL, "{}[],");
slice_t value = {
.len = strlen(token),
@vgrichina
vgrichina / web4-min.zig
Last active March 15, 2024 00:20
Minimalistic Web4 demo using Zig language
const std = @import("std");
// NOTE: In smart contract context don't really have to free memory before execution ends
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
var allocator = arena.allocator();
// Import host functions provided by NEAR runtime.
// See https://github.com/near/near-sdk-rs/blob/78c16447486285fd952765ef3e727e16d6c8c867/near-sdk/src/environment/env.rs#L117
extern fn input(register_id: u64) void;
extern fn read_register(register_id: u64, ptr: u64) void;
select
to_timestamp(receipt_included_in_block_timestamp / 1000000000) as timestamp,
(args->>'deposit')::numeric / (10 ^ 24) as deposit,
receipt_predecessor_account_id
from action_receipt_actions
where receipt_receiver_account_id = 'root.near'
and receipt_predecessor_account_id != 'system'
@vgrichina
vgrichina / index.html
Last active April 5, 2021 00:20
libp2p pubsub web demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>js-libp2p parcel.js browser example</title>
</head>
<body>
@vgrichina
vgrichina / set-contract-to-deploy.md
Created June 18, 2020 22:28
How to deploy contract from AssemblyScript

You can do following to allow passing blob into contract without a lot of overhead:

export function setContractToDeploy(): void {
     env.input(0);
     util.read_register(0);
     // ...
}
async function deploy(options) {
const configPath = process.cwd() + '/src/config';
const config = require(configPath)(process.env.NODE_ENV || 'development');
const near = await nearlib.connect({...config, deps: { keyStore: new UnencryptedFileSystemKeyStore('./neardev') } });
const contractData = [...fs.readFileSync(options.wasmFile)];
const account = await near.account(options.accountId);
await account.signAndSendTransaction(options.accountId, [
deployContract(contractData),
// TODO: Use whatever actual params need to be for functionCall or include any other actions as well
[I] ➜ yarn start
yarn run v1.21.1
warning package.json: No license field
$ npm run build && near deploy --wasmFile ./contract/res/status_message.wasm
npm WARN lifecycle The node binary used for scripts is /var/folders/3c/zjk2krns25s75x_z2_wdvgg80000gn/T/yarn--1580160108615-0.8711654915114355/node but npm is using /Users/vg/n/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> [email protected] build /Users/vg/Documents/create-near-app/blank-rust-proj-vg
> cd contract && ./build.sh
Updating crates.io index