Skip to content

Instantly share code, notes, and snippets.

@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;
@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 July 14, 2024 16:47
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 June 30, 2024 19:33
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 July 1, 2024 13:52
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!

@kepano
kepano / obsidian-web-clipper.js
Last active July 22, 2024 07:29
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@SiccarPoint
SiccarPoint / fix_html_xml.sh
Last active October 12, 2022 09:09
Clean up an imported reference xml in Zotero that contains bad html tags from e.g. Papers3 export
# Guaranteed for mac only due to syntax of sed function, but changes for
# other OS should be minor.
# Ensure you have sqlite3 on your machine.
# Remember to set unix permissions on this file before running:
# chmod 755 fix_html_xml.sh
# and run:
# ./fix_html_xml.sh
# This script should run clean! If you see errors, it won't have worked.
# Will probably take a while to run (mins)