ollama notes; grid
This commit is contained in:
24
AI/aider/notes.md
Normal file
24
AI/aider/notes.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
https://aider.chat/docs/llms/lm-studio.html
|
||||||
|
|
||||||
|
https://aider.chat/docs/llms/ollama.html
|
||||||
|
|
||||||
|
aider --model lm_studio/qwen3-30b-a3b-2507
|
||||||
|
|
||||||
|
|
||||||
|
aider --model lm_studio/deepseek-r1-distill-qwen-7b
|
||||||
|
|
||||||
|
aider --no-show-model-warnings --no-gitignore --model lm_studio/deepseek-r1-distill-qwen-14b
|
||||||
|
|
||||||
|
aider --no-show-model-warnings --no-gitignore --model ollama_chat/gpt-oss:20b
|
||||||
|
|
||||||
|
|
||||||
|
MCP:
|
||||||
|
git
|
||||||
|
|
||||||
|
pip install mcp-server-git
|
||||||
|
python -m mcp_server_git
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
continue config: C:\Users\popov\.continue\config.json
|
@ -3,21 +3,20 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>4 cm Sticker Sheet – Hex vs Grid (Print-Fixed)</title>
|
<title>4 cm Sticker Sheet – Hex vs Grid (Negative Gutter)</title>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--sticker-diameter-cm: 4; /* Content circle diameter */
|
--sticker-diameter-cm: 4; /* Content circle diameter */
|
||||||
--gutter-cm: 0; /* Space between outer edges */
|
--gutter-cm: 0; /* Can be negative for overlap */
|
||||||
--margin-cm: 0; /* Safety/printer margin */
|
--margin-cm: 0; /* Safety/printer margin */
|
||||||
--outline-on: 0; /* 1 show outline, 0 none */
|
--outline-on: 0; /* 1 show outline, 0 none */
|
||||||
--outline-mm: 0.3; /* Outline width when enabled */
|
--outline-mm: 0.3; /* Outline width when enabled */
|
||||||
--fit-mode: cover; /* cover|contain */
|
--fit-mode: cover; /* cover|contain */
|
||||||
--page-width-cm: 21; /* A4 by default */
|
--page-width-cm: 21; /* A4 default */
|
||||||
--page-height-cm: 29.7;
|
--page-height-cm: 29.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Base @page; the exact size is injected dynamically so the printer uses
|
/* Printer page size is injected dynamically based on chosen paper/orientation. */
|
||||||
the selected paper & orientation without scaling. */
|
|
||||||
@page { margin: 0; }
|
@page { margin: 0; }
|
||||||
|
|
||||||
* { box-sizing: border-box; }
|
* { box-sizing: border-box; }
|
||||||
@ -54,7 +53,7 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.controls input[type="number"] {
|
.controls input[type="number"] {
|
||||||
width: 6.5em;
|
width: 7.5em;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
}
|
}
|
||||||
.controls select, .controls button, .controls input[type="file"] {
|
.controls select, .controls button, .controls input[type="file"] {
|
||||||
@ -87,15 +86,14 @@
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On-screen preview uses px so it fits the viewport nicely.
|
/* On-screen preview in px; print overrides to cm below. */
|
||||||
For print we override width/height to exact cm below. */
|
|
||||||
.page {
|
.page {
|
||||||
background: white;
|
background: white;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
box-shadow: 0 1px 4px rgba(0,0,0,0.08);
|
box-shadow: 0 1px 4px rgba(0,0,0,0.08);
|
||||||
outline: 1px dashed #e5e7eb;
|
outline: 1px dashed #e5e7eb;
|
||||||
width: calc(var(--page-width-cm) * 37.8px); /* screen preview only */
|
width: calc(var(--page-width-cm) * 37.8px);
|
||||||
height: calc(var(--page-height-cm) * 37.8px);
|
height: calc(var(--page-height-cm) * 37.8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +125,7 @@
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print: force exact physical size (cm) so PDF printers don't scale or clip. */
|
/* Print: exact physical size to avoid the “quarter page” issue. */
|
||||||
@media print {
|
@media print {
|
||||||
body { background: white; }
|
body { background: white; }
|
||||||
.controls { display: none !important; }
|
.controls { display: none !important; }
|
||||||
@ -146,7 +144,6 @@
|
|||||||
.page { width: 100%; height: auto; aspect-ratio: var(--page-width-cm) / var(--page-height-cm); }
|
.page { width: 100%; height: auto; aspect-ratio: var(--page-width-cm) / var(--page-height-cm); }
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- This style tag will be populated dynamically to set @page size -->
|
|
||||||
<style id="page-size-style"></style>
|
<style id="page-size-style"></style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -162,11 +159,12 @@
|
|||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Sticker Ø (cm)
|
Sticker Ø (cm)
|
||||||
<input id="diameter" type="number" step="0.1" min="1" value="4">
|
<input id="diameter" type="number" step="0.05" min="1" value="4">
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Gutter (cm)
|
Gutter (cm)
|
||||||
<input id="gutter" type="number" step="0.1" min="0" value="0">
|
<!-- Allow negative input; code will clamp to a safe minimum based on diameter. -->
|
||||||
|
<input id="gutter" type="number" step="0.05" min="-5" value="0">
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Printer margin (cm)
|
Printer margin (cm)
|
||||||
@ -213,7 +211,7 @@
|
|||||||
<span class="stats" id="stats">–</span>
|
<span class="stats" id="stats">–</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="hint">Print to PDF at 100% scale (or “Actual size”) with backgrounds enabled. If edges clip, increase Printer margin slightly (0.3–0.5 cm).</span>
|
<span class="hint">Gutter can be negative for slight overlap. Print at 100% with backgrounds enabled. If edges clip, increase Printer margin (e.g., 0.3–0.5 cm).</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -245,7 +243,7 @@
|
|||||||
|
|
||||||
let imageDataURL = null;
|
let imageDataURL = null;
|
||||||
|
|
||||||
// Update on any change
|
// Live updates
|
||||||
['change','input'].forEach(evt => {
|
['change','input'].forEach(evt => {
|
||||||
[el.layout, el.diameter, el.gutter, el.margin, el.outline, el.paper, el.orientation, el.fit].forEach(ctrl => {
|
[el.layout, el.diameter, el.gutter, el.margin, el.outline, el.paper, el.orientation, el.fit].forEach(ctrl => {
|
||||||
ctrl.addEventListener(evt, render);
|
ctrl.addEventListener(evt, render);
|
||||||
@ -266,13 +264,12 @@
|
|||||||
setTimeout(() => window.print(), 50);
|
setTimeout(() => window.print(), 50);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initial render
|
render(); // initial
|
||||||
render();
|
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
const layout = el.layout.value; // 'hex' or 'grid'
|
const layout = el.layout.value; // 'hex' or 'grid'
|
||||||
const d = clampNum(parseFloat(el.diameter.value), 1, 100); // content diameter (cm)
|
const d = clampNum(parseFloat(el.diameter.value), 1, 100); // content diameter (cm)
|
||||||
const g = clampNum(parseFloat(el.gutter.value), 0, 5); // gutter (cm)
|
const gInput = parseFloat(el.gutter.value); // can be negative
|
||||||
const m = clampNum(parseFloat(el.margin.value), 0, 5); // margin (cm)
|
const m = clampNum(parseFloat(el.margin.value), 0, 5); // margin (cm)
|
||||||
const outlineOn = el.outline.value === '1' ? 1 : 0;
|
const outlineOn = el.outline.value === '1' ? 1 : 0;
|
||||||
const fit = el.fit.value === 'contain' ? 'contain' : 'cover';
|
const fit = el.fit.value === 'contain' ? 'contain' : 'cover';
|
||||||
@ -281,16 +278,15 @@
|
|||||||
const isLandscape = el.orientation.value === 'landscape';
|
const isLandscape = el.orientation.value === 'landscape';
|
||||||
if (isLandscape) [w, h] = [h, w];
|
if (isLandscape) [w, h] = [h, w];
|
||||||
|
|
||||||
// Push CSS variables
|
// Push CSS variables for preview
|
||||||
document.documentElement.style.setProperty('--sticker-diameter-cm', d);
|
document.documentElement.style.setProperty('--sticker-diameter-cm', d);
|
||||||
document.documentElement.style.setProperty('--gutter-cm', g);
|
|
||||||
document.documentElement.style.setProperty('--margin-cm', m);
|
document.documentElement.style.setProperty('--margin-cm', m);
|
||||||
document.documentElement.style.setProperty('--page-width-cm', w);
|
document.documentElement.style.setProperty('--page-width-cm', w);
|
||||||
document.documentElement.style.setProperty('--page-height-cm', h);
|
document.documentElement.style.setProperty('--page-height-cm', h);
|
||||||
document.documentElement.style.setProperty('--outline-on', outlineOn);
|
document.documentElement.style.setProperty('--outline-on', outlineOn);
|
||||||
document.documentElement.style.setProperty('--fit-mode', fit);
|
document.documentElement.style.setProperty('--fit-mode', fit);
|
||||||
|
|
||||||
// Force the printer page to use exactly this size (prevents the "quarter page" issue).
|
// Force printer page size
|
||||||
el.pageSizeStyle.textContent = `@page { size: ${w}cm ${h}cm; margin: 0; }`;
|
el.pageSizeStyle.textContent = `@page { size: ${w}cm ${h}cm; margin: 0; }`;
|
||||||
|
|
||||||
// Build page
|
// Build page
|
||||||
@ -302,15 +298,22 @@
|
|||||||
page.appendChild(canvas);
|
page.appendChild(canvas);
|
||||||
el.pages.appendChild(page);
|
el.pages.appendChild(page);
|
||||||
|
|
||||||
// Dimensions inside margins (cm)
|
// Dimensions inside margins
|
||||||
const W = w - 2*m;
|
const W = w - 2*m;
|
||||||
const H = h - 2*m;
|
const H = h - 2*m;
|
||||||
|
|
||||||
// Outer diameter (content + outline on both sides)
|
// Outline width in cm
|
||||||
const outlineWidthCm = outlineOn ? (getCssNumber('--outline-mm') / 10) : 0; // mm -> cm
|
const outlineWidthCm = outlineOn ? (getCssNumber('--outline-mm') / 10) : 0; // mm -> cm
|
||||||
const outerD = d + 2*outlineWidthCm;
|
const outerD = d + 2*outlineWidthCm;
|
||||||
|
|
||||||
// Generate placements
|
// Allow negative gutter but keep step positive (pitch > 0).
|
||||||
|
// Minimum safe gutter is just above -outerD so that pitch stays positive.
|
||||||
|
const MIN_EPS = 0.01; // 0.01 cm = 0.1 mm
|
||||||
|
const gSafeMin = -(outerD - MIN_EPS);
|
||||||
|
const g = clampNum(isNaN(gInput) ? 0 : gInput, gSafeMin, 5); // upper bound 5 cm
|
||||||
|
document.documentElement.style.setProperty('--gutter-cm', g);
|
||||||
|
|
||||||
|
// Generate placements with the sanitized gutter
|
||||||
const placements = (layout === 'grid')
|
const placements = (layout === 'grid')
|
||||||
? packGrid(W, H, outerD, g)
|
? packGrid(W, H, outerD, g)
|
||||||
: packHex(W, H, outerD, g);
|
: packHex(W, H, outerD, g);
|
||||||
@ -318,13 +321,12 @@
|
|||||||
// Render stickers
|
// Render stickers
|
||||||
placements.forEach(p => {
|
placements.forEach(p => {
|
||||||
const s = createSticker(imageDataURL);
|
const s = createSticker(imageDataURL);
|
||||||
// Align content circle; outline is border around it
|
|
||||||
s.style.left = cm(p.x + outlineWidthCm);
|
s.style.left = cm(p.x + outlineWidthCm);
|
||||||
s.style.top = cm(p.y + outlineWidthCm);
|
s.style.top = cm(p.y + outlineWidthCm);
|
||||||
canvas.appendChild(s);
|
canvas.appendChild(s);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Compare both layouts
|
// Compare both layouts (using the same safe gutter)
|
||||||
const hexCount = packHex(W, H, outerD, g).length;
|
const hexCount = packHex(W, H, outerD, g).length;
|
||||||
const gridCount = packGrid(W, H, outerD, g).length;
|
const gridCount = packGrid(W, H, outerD, g).length;
|
||||||
const used = placements.length;
|
const used = placements.length;
|
||||||
@ -332,13 +334,15 @@
|
|||||||
const areaCircle = Math.PI * Math.pow(outerD/2, 2);
|
const areaCircle = Math.PI * Math.pow(outerD/2, 2);
|
||||||
const coverage = areaCanvas > 0 ? (used * areaCircle / areaCanvas) : 0;
|
const coverage = areaCanvas > 0 ? (used * areaCircle / areaCanvas) : 0;
|
||||||
const gain = hexCount - gridCount;
|
const gain = hexCount - gridCount;
|
||||||
const gainText = gain === 0 ? 'same'
|
const gainText = gain === 0 ? 'same' : (gain > 0 ? `+${gain} with Hex` : `+${-gain} with Grid`);
|
||||||
: (gain > 0 ? `+${gain} with Hex` : `+${-gain} with Grid`);
|
|
||||||
|
// If user requested a gutter below safe min, indicate clamping.
|
||||||
|
const clampedNote = gInput < gSafeMin ? ` (clamped to ${g.toFixed(2)} cm)` : '';
|
||||||
|
|
||||||
el.stats.innerHTML =
|
el.stats.innerHTML =
|
||||||
`<strong>${layout.toUpperCase()}</strong> layout: ${used} stickers • ` +
|
`<strong>${layout.toUpperCase()}</strong> layout: ${used} stickers • ` +
|
||||||
`Ø ${d.toFixed(1)} cm${outlineOn ? ` + ${Math.round(outlineWidthCm*10)} mm outline` : ''}` +
|
`Ø ${d.toFixed(2)} cm${outlineOn ? ` + ${Math.round(outlineWidthCm*10)} mm outline` : ''}` +
|
||||||
(g > 0 ? ` • Gutter ${g.toFixed(1)} cm` : ' • No gutter') +
|
` • Gutter ${g.toFixed(2)} cm${clampedNote}` +
|
||||||
` • Coverage ${(coverage*100).toFixed(1)}%` +
|
` • Coverage ${(coverage*100).toFixed(1)}%` +
|
||||||
` — Compare ⇒ Hex: ${hexCount}, Grid: ${gridCount} (${gainText})`;
|
` — Compare ⇒ Hex: ${hexCount}, Grid: ${gridCount} (${gainText})`;
|
||||||
|
|
||||||
@ -350,21 +354,23 @@
|
|||||||
msg.style.placeItems = 'center';
|
msg.style.placeItems = 'center';
|
||||||
msg.style.color = '#6b7280';
|
msg.style.color = '#6b7280';
|
||||||
msg.style.fontSize = '14px';
|
msg.style.fontSize = '14px';
|
||||||
msg.textContent = 'No stickers fit with current settings. Reduce margins/gutter or switch orientation.';
|
msg.textContent = 'No stickers fit with current settings. Reduce margins or adjust gutter/orientation.';
|
||||||
canvas.appendChild(msg);
|
canvas.appendChild(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hexagonal packing
|
// Hexagonal packing
|
||||||
function packHex(W, H, outerD, gutter) {
|
function packHex(W, H, outerD, g) {
|
||||||
const res = [];
|
const res = [];
|
||||||
const pitchX = outerD + gutter;
|
const pitchX = outerD + g;
|
||||||
const pitchY = (Math.sqrt(3) / 2) * outerD + gutter;
|
const pitchY = (Math.sqrt(3) / 2) * outerD + g;
|
||||||
const halfStep = 0.5 * (outerD + gutter);
|
const halfStep = 0.5 * (outerD + g);
|
||||||
|
|
||||||
|
if (pitchX <= 0 || pitchY <= 0) return res; // safety
|
||||||
|
|
||||||
let y = 0, row = 0;
|
let y = 0, row = 0;
|
||||||
while (y + outerD <= H + 1e-6) {
|
while (y + outerD <= H + 1e-6) {
|
||||||
let x = (row % 2 === 1) ? halfStep : 0;
|
let x = (row % 2 === 1) ? Math.max(0, halfStep) : 0;
|
||||||
while (x + outerD <= W + 1e-6) {
|
while (x + outerD <= W + 1e-6) {
|
||||||
res.push({ x, y });
|
res.push({ x, y });
|
||||||
x += pitchX;
|
x += pitchX;
|
||||||
@ -377,10 +383,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rows & columns grid
|
// Rows & columns grid
|
||||||
function packGrid(W, H, outerD, gutter) {
|
function packGrid(W, H, outerD, g) {
|
||||||
const res = [];
|
const res = [];
|
||||||
const pitchX = outerD + gutter;
|
const pitchX = outerD + g;
|
||||||
const pitchY = outerD + gutter;
|
const pitchY = outerD + g;
|
||||||
|
|
||||||
|
if (pitchX <= 0 || pitchY <= 0) return res; // safety
|
||||||
|
|
||||||
let y = 0;
|
let y = 0;
|
||||||
while (y + outerD <= H + 1e-6) {
|
while (y + outerD <= H + 1e-6) {
|
||||||
|
10
ai-ollama.md
10
ai-ollama.md
@ -1,2 +1,10 @@
|
|||||||
run llama code 7b in ollama"
|
run llama code 7b in ollama"
|
||||||
ollama run codellama:7b-code
|
ollama run codellama:7b-code
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OLLAMA_GPU_LAYERS=-1 ollama run gpt-oss:20b
|
||||||
|
|
||||||
|
$env:OLLAMA_DEBUG = "1"
|
||||||
|
$env:OLLAMA_GPU_LAYERS = "-1"
|
||||||
|
ollama serve
|
Reference in New Issue
Block a user