Skip to content

Instantly share code, notes, and snippets.

View Hubbitus's full-sized avatar

Pavel Alexeev aka Pahan-Hubbitus Hubbitus

  • Saint-Petersburg, Russia
View GitHub Profile
@Hubbitus
Hubbitus / fix-tsm-notreadable.js
Created November 25, 2026 01:09
Find and delete unreadable Tab Session Manager records (Firefox IndexedDB) — fixes 'only one session is listed' after a blob file is lost
/**
* Find (and optionally delete) unreadable Tab Session Manager records in Firefox.
*
* Symptom it fixes: the TSM popup lists only a handful of sessions (often exactly one)
* although hundreds or thousands are stored, and re-importing sessions does not help.
*
* Cause: TSM's session-list reader walks the whole "sessions" IndexedDB store with a
* single cursor. One record whose externalised blob file (idb/<db>.files/<n>) is missing
* makes the read fail with NotReadableError; the cursor transaction aborts, the stream of
* batches stops, and every session after that record never reaches the popup.
@Hubbitus
Hubbitus / tsm_extract.py
Created November 23, 2026 02:49
Extract Tab Session Manager sessions from Firefox IndexedDB (Snappy + SpiderMonkey structured-clone parser, based on google/dfindexeddb, Apache-2.0). Standalone: stdlib + system libsnappy via ctypes.
#!/usr/bin/env python3
"""Extract Tab Session Manager sessions from Firefox IndexedDB.
Firefox IndexedDB stores each session as a structured clone (SpiderMonkey
format: stream of 64-bit [data:4][tag:4] pairs, tag in the high 32 bits).
Large records are Snappy-framed compressed in the `.files` directory.
Parser logic ported (heavily simplified) from Google dfindexeddb
(Apache-2.0): dfindexeddb/indexeddb/firefox/gecko.py, definitions.py.
Snappy decompression via ctypes binding to system libsnappy.so.1.
@Hubbitus
Hubbitus / mount.afuse
Created February 11, 2017 15:00
Afuse sshfs automounter (/usr/sbin/mount.afuse)
#!/bin/bash
# afuse-sshfs mount helper to automatically mount remote machines.
# It is intended to be used as mount.afuse in command line. F.e. in /etc/fstab you may mount directory like:
# afuse# /mnt/remote afuse auto 0 0
# And then as regular user just do:
# $ cd /mnt/remote/user@remote.host/remote/path
# and folder /mnt/remote/user@remote.host will be mounted automatically!
#
# On Mac some also recommend add defer_permissions,noappledouble mount options.
find -type f -exec sh -c 'F=$( basename "{}" ); mv $F $(echo $F | sed -r "s/^([[:digit:]]+).+?/\1/")' \;
execve("/usr/bin/kcolorchooser", ["kcolorchooser"], [/* 75 vars */]) = 0
brk(NULL) = 0x5619369e1000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffbf6d20000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=271676, ...}) = 0
mmap(NULL, 271676, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ffbf6cdd000
close(3) = 0
open("/lib64/libKF5XmlGui.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p5\4\0\0\0\0\0"..., 832) = 832
@Hubbitus
Hubbitus / gist:42a00248e3f0012d6ebf
Last active August 29, 2015 14:15
Modularizing groovy config workaround
// For structured comment of http://naleid.com/blog/2009/07/30/modularizing-groovy-config-files-with-a-dash-of-meta-programming
// SecurityConfigPlain.groovy
security {
includeScript( SecurityDefaults )
active = true
password = 'redefined'
}
// and then use (OtherClass.groovy):
var template = $.templates({
specialistsTmpl: tmpl
});
$.templates.specialistsTmpl.link(container, {
specialists: list
}, {
onAfterCreate: function(view){
if (view.data instanceof Specialist){
console.log('onAfterCreate', view, view.data, view.tmpl.tmplName, view.data instanceof Specialist);
$(view.nodes()).find('.edit').click(
Object to save test тест "test тест" main.js:98
Success set: ["test тест"], {"response":1} main.js:108
Success get: ["test ����"], {"response":"\"test ����\""} main.js:116
Добрый вечер. У меня какая-то странная проблема с кодировкой (UTF-8) в storage.get/set.
Простой код:
var t = { en: 'test', ru: 'тест' };
console.log('Object to save', t, JSON.stringify(t));
VK.api(
'storage.set'
,{
key: 'test'
,value: JSON.stringify(t)