This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of how to keccak encode a hex value. Used for converting Snapshot proposal ID to Votium Initiate Deposit _proposal parameter. | |
# | |
# Given the Snapshot proposal ID: | |
# https://snapshot.org/#/cvx.eth/proposal/0xd2f6785ba7e199e3a0169c9bfd561ae6d7c81baa54de4291eef0c355251eb94c | |
# 0xd2f6785ba7e199e3a0169c9bfd561ae6d7c81baa54de4291eef0c355251eb94c | |
# | |
# Should match the following Votium initiation proposal ID: | |
# https://etherscan.io/tx/0xcb95fedbcbd8889a741e0a12a61536e0bcc46b13b59c997abda8f1e214ede253 | |
# 0xab60d2a73796b1c01607b025b4fa6b83332b0adee021020a42ce56c88d9eebe2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from web3 import Web3 | |
# Connect to a local Ethereum node | |
HTTP_PROVIDER='http://localhost:8545' | |
w3 = Web3(Web3.HTTPProvider(HTTP_PROVIDER)) | |
def find_block_number_by_timestamp(target_timestamp, tolerance=60): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--SCRIPT-- | |
-- IMPORTANT SETTINGS | |
set peopleFolder to "/Users/sean/Vaults/Main/People/" | |
-- Create contacts from files | |
set fileNames to list folder (POSIX file peopleFolder) without invisibles | |
repeat with i from 1 to count of fileNames | |
set aFileName to item i of fileNames | |
set filePath to (peopleFolder & aFileName) as POSIX file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Set the folder path for the Obsidian notes | |
set folderPath to "/Users/sean/Vaults/Test/People" | |
-- Function to convert special labels to human-readable form and title case them | |
on getReadableLabel(originalLabel) | |
if originalLabel is "_$!<Home>!$_" then | |
return "Home" | |
else if originalLabel is "_$!<Work>!$_" then | |
return "Work" | |
else if originalLabel is "_$!<Mobile>!$_" then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Task Processor Plugin for Obsidian | |
To use this plugin: | |
1. Create a directory named "task-proc" under your vault plugin directory | |
(e.g. .obsidian/plugins/task-proc) | |
2. Copy this file (main.js) and manifest.json to the "task-proc" directory | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Place this file in your path | |
# Mark it executable (chmod +x ask) | |
# You will need openai lib installed (pip install openai) | |
# You will also need to set the OPENAI_API_KEY environment variable | |
import os | |
import sys | |
from openai import OpenAI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import OpenAI | |
import os | |
import sys | |
api_key = os.getenv("OPENAI_API_KEY") | |
if not api_key: | |
raise ValueError("OPENAI_API_KEY environment variable not set") | |
exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){ | |
var url = window.location.href; | |
var newUrl = "https://kagi.com/summarizer/?url=" + url; | |
window.open(newUrl, "_blank"); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){ | |
var url = window.location.href; | |
var strippedUrl = url.split('?')[0]; | |
if (navigator.clipboard) { | |
navigator.clipboard.writeText(strippedUrl).then(function() { | |
console.log('URL copied to clipboard successfully!'); | |
}).catch(function(err) { | |
console.error('Could not copy URL: ', err); | |
}); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from datetime import datetime | |
from os import path | |
DATA_DIR = 'data' | |
VAULT_DIR = 'vault' | |
JOURNAL = 'World' | |
def parse_date(s: str): | |
datestr = s[0:10] |
NewerOlder