Skip to content

Instantly share code, notes, and snippets.

View jpolvora's full-sized avatar
🏠
Working from home

Jone jpolvora

🏠
Working from home
View GitHub Profile
@jpolvora
jpolvora / muse-code
Created September 17, 2026 03:17
muse-code wrappers: run the native Muse Code Windows build (installed via irm https://dev.meta.ai/install.ps1 | iex) from Git Bash MINGW (with MSYS path translation) and from cmd/pwsh
#!/usr/bin/env bash
# muse-code — Git Bash (MINGW/MSYS/CYGWIN) wrapper for the native Muse Code Windows build.
#
# Background: the installer (irm https://dev.meta.ai/install.ps1 | iex) puts the
# real Windows build in %LOCALAPPDATA%\Programs\muse (muse.cmd + muse-bin-*.exe),
# which is NOT on PATH. The bash launcher at ~/.local/bin/muse only supports
# macOS/Linux and dies with "unsupported platform: MINGW64_..." under Git Bash.
# This wrapper (named muse-code to avoid clashing with `muse`) forwards to the
# Windows .exe with MSYS path translation, so `muse-code` works from Git Bash.
#

AGENTS.md — Windows Host Administration & Management

Core Philosophy

You are an autonomous administrative assistant for Windows. System stability and data privacy are your highest priorities. You are explicitly instructed to avoid any actions that could compromise the operating system, erase user data, or expose sensitive configurations. When in doubt, inspect first, ask second, act last.

General Principles

  • Read-only first — always inspect before modifying. Prefer Get-* cmdlets over Set-*.
  • Prefer non-destructive queries — use Get-Command, Get-Service, Get-Process, Test-Path before making changes.
  • Backup before changes — export registry keys, create restore points, copy config files before modifying.
  • Make one change at a time, verify, then proceed.
@jpolvora
jpolvora / proxmox-AGENTS.md
Created June 29, 2026 22:02
an agents.md for proxmox

AGENTS.md — Proxmox / Linux Host with LXC & VMs

General Principles

  • Read-only first — always inspect before modifying.
  • Prefer non-destructive queries — use pct list, qm list, pvesh over direct config edits.
  • Backup before changes — snapshot VMs/LXC via pvesr or vzdump before risky operations.
  • Make one change at a time, verify, then proceed.
  • Use pct / qm CLI rather than raw config file editing when possible — they validate inputs.

System Critical Criteria (Safety First)

@jpolvora
jpolvora / CustomRateLimiterAttribute.cs
Created December 8, 2025 19:38
CustomRateLimiterAttribute for ASP.NET 4 MVC 5
using System;
using System.Net;
using System.Runtime.Caching;
using System.Web;
using System.Web.Mvc;
public class CustomRateLimitAttribute : ActionFilterAttribute
{
// These properties are set when applying the attribute:
// [CustomRateLimit(Limit = 5, WindowInMinutes = 1)]
@jpolvora
jpolvora / SQLQueryBuilder.cs
Created July 4, 2024 14:45
SQL Query Builder for SQL Server with paging, no lock (Dapper version parameters)
using System.Collections.Generic;
using Dapper;
using System.Text;
public class SQLQueryBuilder
{
private readonly StringBuilder _sb = new StringBuilder();
private readonly List<string> _fieldNames = new List<string>();
private readonly List<string> _joins = new List<string>();
<!-- Custom caching policy for on HTTP POST for Azure API Management:
1. Policy looks in the Request body - 'cacheKey' property which then used as cache key.
Expected values are: <null>, ALL or NOEXPIRED
Defaults to ALL in case <null>
2. Cache expiration set to 60 seconds/1 minute
!-->
<policies>
<inbound>
<base />
const debug = require('./debug.config')('app:router-wrapper', console)
const wrapMethod = function (router, method) {
if (typeof router[method] !== "function") return false;
const original = router[method].bind(router);
debug('patching method: %o', method)
router[method] = (...args) => {
if (args.length < 2) return original(...args);
//first param can be string or array of strings, need to check and slice before get the middlewares array
@jpolvora
jpolvora / andre.php
Last active September 7, 2018 07:26
<?php
include '../funcoes.php';
include '../conecta.php';
function insert(&$insert_fields)
{
$insert_sql = 'INSERT INTO fases '
.' ('.implode(', ', array_keys($insert_fields)).')'
.' VALUES ('.implode(', ', array_values($insert_fields)).')';
@jpolvora
jpolvora / mongo-clear-collections.js
Created March 28, 2018 05:24
Shell command for Remove all documents for all collections of a MongoDb. Use with caution.
/* use in a shell like robomongo / robo3t */
db.getCollectionNames().forEach(
function(collection_name) {
db[collection_name].remove({})
}
);
int avoidObstacles(int[] inputArray)
{
var jump = 2;
var max = inputArray.Max() + 1;
while (jump <= max)
{
int multiplier = 1;
bool success = false;
while (true)
{