Skip to content

Instantly share code, notes, and snippets.

@joeddav
joeddav / logseq-custom.css
Last active November 5, 2023 21:29
My custom.css logseq file. Useful for defining iOS-compatible configuration.
/* @import url('https://rcvd.github.io/logseq-bear-theme/bear.css'); */
/* @import url('https://cdn.jsdelivr.net/gh/gavinmn/logseq-luma/custom.css'); */
/* ## BONOFIX THEME */
@charset "UTF-8";@import url("https://cdn.jsdelivr.net/npm/@ibm/plex@4.0.2/css/ibm-plex.min.css?family=IBM+Plex+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap");:root{--ls-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,"Apple Color Emoji",Arial,sans-serif,"Segoe UI Emoji","Segoe UI Symbol";--ls-tag-text-opacity:.6;--ls-tag-text-hover-opacity:.8;--ls-page-text-size:1em;--ls-page-title-size:36px}.dark-theme,html[data-theme=dark]{--ls-primary-background-color:#202124;--ls-secondary-background-color:#27282b;--ls-tertiary-background-color:#2e3033;--ls-quaternary-background-color:#36383b;--ls-table-tr-even-background-color:#adadad1c;--ls-callout-background-color:rgba(69,75,78,0.3);--bf-codeblock-background-color:#313538;--ls-block-properties-background-color
@joeddav
joeddav / chatgpt.py
Last active August 5, 2023 14:29
Simple ChatGPT
import openai
class ChatGPT:
""" A very simple wrapper around OpenAI's ChatGPT API. Makes it easy to create custom messages & chat. """
def __init__(self, model="gpt-3.5-turbo", completion_hparams=None):
self.model = model
self.completion_hparams = completion_hparams or {}
self.history = []
self._messages = []
@joeddav
joeddav / safeDelete.js
Created October 5, 2022 00:39
Safe file deletion in Obsidian with QuickAdd
module.exports = async function safeDelete(params) {
const {app, quickAddApi: {inputPrompt}} = params;
const file = app.workspace.getActiveFile();
let shouldDelete = false;
if (file.stat.size === 0) {
shouldDelete = true;
} else {
const input = await inputPrompt(
@joeddav
joeddav / obsidian-calendar-dot.css
Created August 7, 2022 19:04
Obsidian styling: calendar dot adjustment
/*
Shared by CabbageCanFly on Discord:
https://discord.com/channels/686053708261228577/702656734631821413/1003776341843394622
*/
.calendar .day .dot-container {
align-items: center;
}
.calendar .day .dot-container svg {
@joeddav
joeddav / image_plotting.py
Last active December 2, 2019 18:39
add matplotlib import
import matplotlib.pyplot as plt
def plot_image(image, ax=None, cmap=None):
if ax is None:
_, ax = plt.subplots()
ax.imshow(image, cmap=cmap)
ax.set_xticklabels([])
ax.set_yticklabels([])
ax.set_aspect('equal')
ax.set_axis_off()
@joeddav
joeddav / jlab.sh
Created October 15, 2018 15:00
Start Jupyter or other local application in Chrome application mode on MacOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app='http://localhost:8888'