Skip to content

Instantly share code, notes, and snippets.

View capaj's full-sized avatar
🏠
Always working-be it from home or elsewhere

Jiri Spac capaj

🏠
Always working-be it from home or elsewhere
View GitHub Profile
@capaj
capaj / README.md
Created December 1, 2026 12:44
Nautilus (GNOME Files) right-click extras: "Copy Full Path" and "Open in Terminal" on folders, with a one-line installer

Nautilus (GNOME Files) right-click extras

Two small nautilus-python extensions:

File Adds
copy_full_path.py Copy Full Path when right-clicking files or folders (several selected → one path per line), and Copy Folder Path when right-clicking empty space.
open_in_terminal.py Open in Terminal when right-clicking a folder. Files only offers this on empty space by default. Selecting several folders opens one terminal each (up to 10).

Works with GNOME Files 43 and newer (GTK 4). Tested on Ubuntu with Nautilus 50.

@capaj
capaj / copy_full_path.py
Created September 24, 2026 11:07
Nautilus (GNOME Files) extension: "Copy Full Path" in the file right-click menu
# Adds "Copy Full Path" to the Nautilus (GNOME Files) context menu.
# Multiple selected files are copied as newline-separated paths.
#
# Install:
# sudo apt install python3-nautilus # Fedora: nautilus-python
# mkdir -p ~/.local/share/nautilus-python/extensions
# cp copy_full_path.py ~/.local/share/nautilus-python/extensions/
# nautilus -q
import gi
@capaj
capaj / ToolLoopAgent.ts
Created January 24, 2026 19:05
ToolLoopAgent error handling
import { google } from '@ai-sdk/google'
import { ToolLoopAgent } from 'ai'
import { z } from 'zod'
const triggerSchema = z.object({
trigger: z.string().describe('any string to trigger')
})
const tools = {
flakyTool: {
@capaj
capaj / runSQL.ts
Last active January 9, 2026 13:28
capajj@gmail.com
import { encode } from '@toon-format/toon'
import { sql } from 'drizzle-orm'
import { db } from './src/db/db' // replace
import { env } from './src/env' // replace
/**
* Run a SQL query against the current database from .env
*/
async function runQuery() {
// Get the SQL query from the command line arguments
@capaj
capaj / inotify.sh
Last active November 29, 2025 08:02
inotify ubuntu sane defaults
sudo tee /etc/sysctl.d/99-inotify.conf >/dev/null <<'EOF'
fs.inotify.max_user_watches = 1048576
fs.inotify.max_user_instances = 2048
fs.inotify.max_queued_events = 32768
EOF
sudo sysctl --system
pnpm dlx shadcn@latest add accordion alert-dialog alert aspect-ratio avatar badge breadcrumb button calendar card carousel checkbox collapsible command context-menu dialog drawer dropdown-menu form hover-card input-otp input label menubar navigation-menu pagination popover progress radio-group resizable scroll-area select separator sheet skeleton slider sonner switch table tabs textarea tooltip
@capaj
capaj / dropAllTables.ts
Last active July 1, 2024 17:50
drizzle-utils
import { getTableName, sql } from 'drizzle-orm'
import * as schema from '../src/schema'
import { db } from '../src/db'
const allTableNames = Object.values(schema).map((table) => getTableName(table))
for (const table of allTableNames) {
console.log(`Dropping table ${table}`)
await db.run(sql.raw(`DROP TABLE ${table}`))
}
import { Column, sql } from 'drizzle-orm'
import { SQLiteTable, SQLiteUpdateSetSource } from 'drizzle-orm/sqlite-core'
export function conflictUpdateSet<TTable extends SQLiteTable>(
table: TTable,
columns: (keyof TTable['_']['columns'] & keyof TTable)[]
): SQLiteUpdateSetSource<TTable> {
return Object.assign(
{},
...columns.map((k) => ({
@capaj
capaj / content-king.ts
Created February 21, 2024 07:22
interview excercise for node.js dev role
import puppeteer from 'puppeteer'
const requestTimings = [] as {
url: string
startTime: number
}[]
async function run() {
const browser = await puppeteer.launch({
headless: false
@capaj
capaj / knex out
Created March 28, 2023 07:27
knex vs prisma
limit $3 undefined +0ms
knex:bindings [ 'c609097c-9d6d-470f-b3f6-200f52e19fe4', 74277, 1 ] undefined +0ms
knex:query select "id" from "favorites" where "aws_user_id" = $1 and "post_id" = $2 limit $3 undefined +3ms
knex:bindings [ 'c609097c-9d6d-470f-b3f6-200f52e19fe4', 74400, 1 ] undefined +2ms
knex:query select "id" from "favorites" where "aws_user_id" = $1 and "post_id" = $2 limit $3 undefined +1ms
knex:bindings [ 'c609097c-9d6d-470f-b3f6-200f52e19fe4', 84433, 1 ] undefined +1ms
knex:query select "id" from "favorites" where "aws_user_id" = $1 and "post_id" = $2 limit $3 undefined +0ms
knex:bindings [ 'c609097c-9d6d-470f-b3f6-200f52e19fe4', 88374, 1 ] undefined +1ms
knex:query select "id" from "favorites" where "aws_user_id" = $1 and "post_id" = $2 limit $3 undefined +1ms
knex:bindings [ 'c609097c-9d6d-470f-b3f6-200f52e19fe4', 89165, 1 ] undefined +0ms