Skip to content

Instantly share code, notes, and snippets.

View mjf's full-sized avatar

Matouš Jan Fialka mjf

View GitHub Profile
@mjf
mjf / show_mysql_grants.sh
Last active July 3, 2025 13:34
Show MySQL grants overview
#! /bin/sh
# Simple script to show MySQL grants overview
# Copyright (C) 2025 Matous Jan Fialka, <https://mjf.cz/>
# Released under the terms of the "MIT" license
mysql -b -u'root' -p << \EOT |
SELECT
`user` AS `user`,
`host` AS `host`,
'Global' AS `scope`,
@mjf
mjf / Admonitions.md
Last active June 24, 2025 10:46
Admonitions for Silverbullet

#meta #meta/template/slash

Declare admonition icons

```space-style
:root {
  --admonition-icon--note:     url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m3.1 5.07c.14 0 .28.05.4.16l1.27 1.27c.23.22.23.57 0 .78l-1 1-2.05-2.05 1-1c.1-.11.24-.16.38-.16m-1.97 1.74 2.06 2.06-6.06 6.06H7.07v-2.06z"/></svg>');
  --admonition-icon--abstract: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 9H7V7h10m0 6H7v-2h10m-3 6H7v-2h7M12 3a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1m7 0h-4.18C14.4 1.84 13.3 1 12 1s-2.4.84-2.82 2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2"/></svg>');
  --admonition-icon--info:     url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A
@mjf
mjf / slow.md
Created June 19, 2025 06:01
tagList
${query[[
  from
    p = index.tag 'page'
  where
    p.perm == 'rw' and
    not table.includes(p.itags, 'meta') and
    not table.includes(p.itags, 'meta/template') and
    not table.includes(p.itags, 'meta/template/page') and
    not p.name.startsWith('Inbox/')
@mjf
mjf / pendingTasksWidget.md
Last active May 27, 2025 10:27
SilverBullet Pending Tasks Widget

Pending Tasks Widget

my = my or {}

my.pendingTasks = function(page)
  return query
  [[
    from
 task = index.tag 'task'
@mjf
mjf / interval.lua
Last active April 29, 2025 09:52
Allen's Interval Algebra implemented in pure Lua
-- Allen's Interval Algebra implemented in pure Lua
-- Copyright (C) 2025 Matouš Jan Fialka, <https://mjf.cz/>
-- Released under the terms of the "MIT" License
local interval = {}
interval.__index = interval
function interval:new(from, to, cmp)
@mjf
mjf / gist:2de38a4f2a8accdcc0f21c1bb0c65a09
Created February 12, 2025 19:04
Sync troubles with SB...
Plug updated, reloading index from _plug/index.plug.js client_system.ts:140:18
Booting up worker for index worker_sandbox.ts:33:12
GET
http://silverbullet.local:12345/_plug/index.plug.js
[HTTP/1.1 304 Not Modified 43ms]
Activated plug index system.ts:161:12
[sync] New file created on secondary, copying from secondary to primary _plug/plug-manager.plug.js sync.ts:157:14
Plug updated, reloading plug-manager from _plug/plug-manager.plug.js client_system.ts:140:18
Booting up worker for plug-manager worker_sandbox.ts:33:12
@mjf
mjf / formatNumber.lua
Last active January 29, 2025 07:12
Simple number formatter in Lua
-- Function formatNumber - Simple number formatter
-- Copyright (C) 2025 Matous Jan Fialka, <https://mjf.cz/>
-- Released under the terms of the "MIT" license
local function formatNumber(format, ...)
local args = { ... }
local argind = 1
local res = ''
local i = 1
@mjf
mjf / radix_fun.lua
Last active January 17, 2025 11:49
Radix functions in Lua (including example usage and a test suite)
local function from_radix(digits, base)
local ip = 0
local fp = 0
local dp = nil
for i, v in ipairs(digits) do
if v == "." then
dp = i
break
end
if type(v) ~= "number" then
@mjf
mjf / Linux-ML-refs.md
Last active August 23, 2024 10:58
Linux mailing lists references
@mjf
mjf / userChrome.css
Created February 8, 2024 08:56
Fix Firefox textarea ligature rendering bug
/**
* Get your profile from about:support page.
* Create ~/.mozilla/firefox/<profile>/chrome directory.
* Place to ~/.mozilla/firefox/<profile>/chrome/userContent.css file.
* Run restorecon -R -F ~/.mozilla/firefox/<profile>/chrome on SELinux-enabled distros.
* Set toolkit.legacyUserProfileCustomizations.stylesheets to true in about:config page.
* Restart Firefox and it should be working.
*/
@-moz-document domain("www.example.com") {