Skip to content

Instantly share code, notes, and snippets.

View dvcrn's full-sized avatar
💫

David dvcrn

💫
View GitHub Profile
@dvcrn
dvcrn / kustomization.yml
Last active November 11, 2024 02:50
Beeper Bridge K8s
# you don't really need Kustomize here but it's convenient
# I mainly use it for the configMapGenerator, basically turnint the file at my local drive under config/facebook.yml (bridge config)
# into a kubernetes config map that then gets mounted into the statefulset
resources:
- pvc.yml
- statefulset.yml
- svc.yml
configMapGenerator:
@dvcrn
dvcrn / README.md
Last active October 8, 2024 23:39
DEVONthink 3 automatic filenames with ChatGPT

To install, make sure you install the openai CLI:

  1. pip3 install openai
  2. Run which openai to get the full path of where the executable is
  3. Copy the path and replace /opt/homebrew/bin/openai in the script with your path if it's different
  4. Update set OPENAI_API_KEY to "xxx" to use your OpenAI key

To use GPT3.5-turbo instead of gpt-4, change /opt/homebrew/bin/openai api chat_completions.create -m gpt-4 to -m gpt-3.5-turbo or other model with larger context window.

@dvcrn
dvcrn / main.go
Created January 22, 2023 05:48
amqp deduper
package main
import (
"context"
"encoding/json"
"time"
"github.com/ReneKroon/ttlcache/v2"
"github.com/dvcrn/amqpdedup/internal/amqp"
"github.com/dvcrn/amqpdedup/internal/domain"
@dvcrn
dvcrn / get_metaplex_metadata.ts
Last active June 26, 2022 19:41
Get Metaplex Metadata
import * as metaplex from "@metaplex/js";
import * as web3 from "@solana/web3.js";
const connection = new web3.Connection(
web3.clusterApiUrl("mainnet-beta"),
"confirmed"
);
const tokenAddress = "CxkKDaBvtHqg8aHBVY8E4YYBsCfJkJVsTAEdTo5k4SEw";
@dvcrn
dvcrn / index.ts
Last active June 15, 2024 23:34
get metadata from metaplex
// EDIT: It's now much easier to get metadata from metaplex using the js package.
// Check the new gist here: https://gist.github.com/dvcrn/a1b0ff0a0b4b3ab02aff44bc84ac4522
// I didn't want to edit this gist because a lot of people found it helpful to see how to manually decode a account
import * as web3 from "@solana/web3.js";
import * as metadata from "./metadata"; // see metadata.ts
const tokenAddress = new web3.PublicKey(
"CxkKDaBvtHqg8aHBVY8E4YYBsCfJkJVsTAEdTo5k4SEw"
);
@dvcrn
dvcrn / mona.applescript
Last active November 20, 2017 20:29
Fetch crypto price in applescript
# example to fetch the current MONA price in JPY
# needs http://www.mousedown.net/mouseware/JSONHelper.html
# replace 'neo' with any other ID supported by coinmarketcap
# using coinmarketcaps convert API to add `price_jpy` to the result
set json_data to (do shell script "curl https://api.coinmarketcap.com/v1/ticker/monacoin/?convert=JPY")
tell application "JSON Helper"
set json_data to read JSON from json_data
end tell
@dvcrn
dvcrn / main.cljs
Created December 29, 2016 08:12
realm example in clojurescript
(def Realm (js/require "realm"))
;; define dog schema
(def dog {:name "Dog"
:properties {:name "string"
:age "int"}})
;; instantiate Realm with the dog schema
(def r (Realm. (clj->js {:schema [dog]})))
@dvcrn
dvcrn / keybase.md
Created August 29, 2016 07:53
keybase.md

Keybase proof

I hereby claim:

  • I am dvcrn on github.
  • I am dvcrn (https://keybase.io/dvcrn) on keybase.
  • I have a public key ASD90ukgjRDay6u9VaMUG_WeXf4xhzUAhUVgaG7Di83jzwo

To claim this, I am signing this object:

@dvcrn
dvcrn / reagent-animated-example.cljs
Last active January 31, 2023 01:08
reagent react-native animation example
;; very simple example on how to use Animated with reagent
;; https://facebook.github.io/react-native/docs/animations.html
(def animated (.-Animated js/React))
(def animated-value (.-Value animated))
(def animated-view (r/adapt-react-class (.-View animated)))
(defn testview []
(r/create-class
@dvcrn
dvcrn / gist:d3b1fe416c017499ddfa
Created July 6, 2015 09:09
linear regression with 1 variable in python
testset = [
[1, 4],
[2, 8],
[3, 12],
[4, 16]
]
theta0 = 0
theta1 = 0
learningrate = 0.01