Skip to content

Instantly share code, notes, and snippets.

@mojzis
mojzis / CLAUDE.md
Last active June 28, 2025 09:04
rules for claude code to be able to generate reasonable notebooks
  • For marimo notebooks: See MARIMO_RULES.md for specific marimo conventions

🚨 CRITICAL MARIMO RULE - NEVER VIOLATE

BEFORE writing ANY marimo cell, check:

  1. Are you putting mo.md(), mo.ui.table(), or ANY display function inside if, try, for, while, or with blocks?
  2. If YES → STOP! You must prepare content inside control blocks, then display OUTSIDE them.

Template pattern:

@mojzis
mojzis / whatsapp_gallery_download.js
Created January 21, 2025 18:34
download pics from whatsapp
@mojzis
mojzis / search.js
Created July 13, 2023 05:56
js search in nav
let searchBox = document.querySelector(".searchBox");
let filterSearch, nav, linkCollection;
function processResults() {
{#input = document.getElementById("mySearch");#}
filterSearch = searchBox.value.toUpperCase();
nav = document.querySelector(".leftnav");
linkCollection = nav.getElementsByClassName("menuitem");
Array.from(linkCollection).forEach(element => {
if (element.innerHTML.toUpperCase().indexOf(filterSearch) > -1) {
element.style.display = "";
# troubleshoot pdf generation
xelatex -no-pdf main # run xetex only
xdvipdfmx -E -vv main.xdv # this shows pontential issues
tasks = [];
$$(".body-content .row").forEach(function(row) {
rowData = [];
im = $$("img",row);
sub = '';
if(im[0]){
sub = im[0].src
rowData.push(sub)
$$("div",row).forEach(function(div) {
rowData.push(div.innerText)
see how is the field saved / tokenized in elastic
{
"query": {
"term": {
"sku": "2306"
}
},
"script_fields": {
"terms": {
# TTFB with curl
curl -o /dev/null -s -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" https://www.google.com/webmasters
-- generate alter table to change default values on columns from previous MySQL version
select
-- TABLE_NAME, COLUMN_NAME,
-- column_type,
concat('ALTER TABLE ', table_name, ' CHANGE ', COLUMN_NAME, ' ', COLUMN_NAME, ' ', column_type,' NOT NULL DEFAULT ',if( COLUMN_DEFAULT = '0000-00-00', "'1000-01-01';", "'1000-01-01 00:00:00';")) alt
from information_schema.columns
where table_schema = 'sourcedb'
and COLUMN_DEFAULT in ('0000-00-00 00:00:00', '0000-00-00')
order by table_name
# show running virtual machines
# https://www.virtualbox.org/manual/ch08.html#vboxmanage-list
VBoxManage list runningvms
# cleanup - list all vms, delete by name (checking the list of folders for date modified can help :)
VBoxManage list vms
VBoxManage unregistervm --delete XXX (name or uid)
# show what vagrant has running
vagrant global-status
du -sh *
# count image sizes in a folder
identify -format '%w\n' * | sort | uniq -c
# list image sizes
identify -format '%i %w \n' *
### TEXT MANIPULATION