Skip to content

Instantly share code, notes, and snippets.

@cspence001
cspence001 / bpcupdate.py
Last active December 13, 2024 17:49
Updates the BPC Chrome extension (installed via "Load Unpacked" in Developer Mode) after verifying the SHA-256 hash of the extension’s ZIP file. On match, the script extracts and updates the extension.
#!/usr/bin/env python3
# Verifies the SHA-256 hash of a downloaded file from (https://gitflic.ru/project/magnolia1234/bpc_uploads) against the hash in [release-hashes.txt](https://gitflic.ru/project/magnolia1234/bpc_uploads/blob/raw?file=release-hashes.txt).
# 1. Downloads the hash file from the [HASH_URL] and extracts the expected hash for the correspondent [FILENAME].
# 2. Downloads the zip-file [FILENAME] from [DOWNLOAD_URL] and calculates its SHA-256 hash.
# 3. Compares the calculated hash with the expected hash.
# 4. On match, prompts the user to move the file to a permanent location [DOWNLOAD_DIR].
# 5. Moves and extracts the file if confirmed; otherwise, deletes the temporary file.
# Note: Before running script, replace [DOWNLOAD_DIR] with permanent location on your computer that you use for your extension, excluding the extracted folder name [EXTRACT_DIR_NAME].
import requests
@bsharper
bsharper / map_models.py
Last active April 8, 2025 03:56
Map ollama models to normal filenames using symbolic links (Linux / macOS / Windows)
# Run without arguments to see what is found.
# Run with a path as an argument to create links to ollama models there.
# This will remove any files that follow the exact filename as the new link file, so use with caution!
import os
import sys
import json
import platform
@dreness
dreness / add_fork_remote.sh
Last active May 4, 2024 08:31
Use gh cli and fzf to add a remote for a fork of the current repo
#!/bin/sh
# Scenario:
# - you have a local checkout of a github repo
# - you're looking at public forks of that repo
# - you want to add a remote to your local checkout for one of the forks
set -e
set -o pipefail
@digitalsignalperson
digitalsignalperson / tabs.css
Created January 23, 2024 09:18
obsidian tabs in multiple rows
/* --------------compact tabs--------------------*/
.workspace .mod-root .workspace-tab-header {
width: unset;
max-width: var(--tab-width);
border: 1px solid var(--color-base-50);
}
/*.workspace-tab-header-inner {
width: unset;
}*/
@m0rtyn
m0rtyn / obsidian-fix-for-nested-code-blocks.md
Last active January 24, 2024 18:28
obsidian-fix-for-nested-code-blocks.css

Fix for codeblocks nested in list items in Obsidian app

Result: image

.HyperMD-codeblock {
  --code-background: #0003;
@pabloasanchez
pabloasanchez / to-netscape-bookmarks.sh
Created July 27, 2023 18:35
Generate a Netscape format Bookmarks.html from a file with a list of URLs
#!/usr/bin/env node
/*
Usage: ./to-netscape-bookmarks.sh urls | tee bookmarks.html
urls is a simple textfile with urls separated by breakline
Titles are pulled with pup tool
*/
const { exec } = require('child_process'), fs = require('fs'), readline = require('readline')
const file = process.argv[2]
@drewkerr
drewkerr / set-focus-mode.js
Created April 13, 2022 14:51
Set a Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
function toggleFocus(focus) {
const app = Application("System Preferences")
const pane = app.panes.byId("com.apple.preference.notifications").anchors.byName("Focus")
app.reveal(pane) // Open the preference pane
// Useful way of inspecting the UI hierarchy of an open app:
// Application("System Events").applicationProcesses.byName("System Preferences").entireContents()
const ui = Application("System Events").applicationProcesses.byName("System Preferences").windows.byName("Notifications & Focus").tabGroups.at(0)
@GitMurf
GitMurf / obsidian.live-preview.css.block-ref-inline.css
Last active April 9, 2025 15:21
CSS for inline block references that works for both NEW CM6 Live Preview and also Preview Mode for both CM5 (Legacy) and CM6 (New)
:root {
/* #7159de (similar to Obsidian purple) */
--block-ref-line-color: grey;
--block-ref-line-type: solid;
--block-ref-line-size: 2px;
/* Set to "inherit" for no bg color */
--block-ref-hover-bg-color: #d4d0d026;
}
/*
@drewkerr
drewkerr / get-focus-mode.js
Last active April 4, 2025 04:29
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {
@thecodingcod
thecodingcod / dbeaver_sqlcipher.md
Last active April 6, 2025 15:58
Setting up Dbeaver (The Universal DBMS) to work with SqlCipher Databases

Setting up Dbeaver (The Universal DBMS) to work with SqlCipher Databases

I’ve tried multiple solutions to browse SqlCipher Databases and the only one that seemed to work properly was [DB Sqlite Browser](DB Browser for SQLite (sqlitebrowser.org)) with easy GUI to get into the db. but … the overall experience of that application didn’t really satisfy me!

I knew DBeaver from long time ago, and i wondered if i can use it with SQLCipher, but it was surprisingly a shock that it doesn’t work directly, but with a couple of hours of researching and trying different methods i finally came up with a way to configure it Out-of-the box to make it work!

The reason I wrote this gist was to help others who have the same issue as it seems there is no guide to show how to do so!