Skip to content

Instantly share code, notes, and snippets.

View bramses's full-sized avatar
🤨

Bram Adams bramses

🤨
View GitHub Profile
<audio controls src="your-cfURL-from-server">
<track kind="captions" />
Your browser does not support the
<code>audio</code> element.
</audio>
@bramses
bramses / Code.gs
Last active October 4, 2024 14:02
Search yCb in Google Docs and paste diresctly into editor
function onOpen() {
DocumentApp.getUi().createMenu('yCb')
.addItem('Send Selected Text to API', 'processSelectedText')
.addToUi();
}
function processSelectedText() {
var doc = DocumentApp.getActiveDocument();
var selection = doc.getSelection();
On picture, look for volume number and link to correct part of video timestamp. If not in system, say not in system. All information sourced from Hunterpdiea (https://hunterxhunter.fandom.com/wiki/Hunterpedia)
On help, tell users what you do and prompt them to upload an image of HxH manga cover.
HxH Vol 1-5: https://youtu.be/FrZHYje8mPc?si=4JCdBJXWA1dKgu5c
6-13: https://youtu.be/FrZHYje8mPc?si=mVWEJT8blFPKJZpW&t=80
14-18: https://youtu.be/FrZHYje8mPc?si=R6sr8eLbn70LH8Ol&t=150
19-22: https://youtu.be/FrZHYje8mPc?si=i8XSTzULIPa9OSDs&t=220
23-30: https://youtu.be/FrZHYje8mPc?si=1Wv7jSTmMkQ7WGJD&t=300
31-32: https://youtu.be/FrZHYje8mPc?si=r5iMR-L7-OEoLv72&t=379
@bramses
bramses / _result.md
Last active January 8, 2024 09:45
Use GPT-4 to automatically diagnose errors

TLDR

I wrapped Python traceback and Exception so whenever an Exception is raised, an automatic diagnosis is done by GPT-4. See results below:

Prompt (Automatically Generated by error_wrap function)

This error message occurred because of 'test' at line 177 in file api.py, function main. The exception type is <class 'Exception'>. The function is:

@bramses
bramses / twitch_thanker_guidance.ipynb
Created May 23, 2023 22:20
Using Guidance to create a Twitch thank you bot
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bramses
bramses / obsidian-publish-swipe.js
Created January 5, 2023 04:10
swipe left to open menu; swipe right to close it
// swipe left on mobile to open menu
let touchstartX = 0;
let touchendX = 0;
function checkDirection() {
// check if greater than 100px
// if swipe right close menu
if (touchendX < touchstartX && touchstartX - touchendX > 100) {
document
.querySelector(".published-container")
@bramses
bramses / publish.js
Last active January 5, 2023 03:49
testing remark42 on obsidian publish
var remark_config = {
host: "https://demo.remark42.com",
site_id: "remark",
};
// https://stackoverflow.com/a/74271142/3952024
async function waitForElement(selector, timeout = null, location = document.body) {
return new Promise((resolve) => {
let element = document.querySelector(selector);
if (element) {
@bramses
bramses / vercel.json
Created January 2, 2023 19:09
:path not working
{
"rewrites": [
{
"source": "/zettelkasten/",
"destination": "https://publish.obsidian.md/serve?url=bramadams.dev/zettelkasten"
},
{
"source": "/zettelkasten/:path*",
"destination": "https://publish.obsidian.md/serve?url=bramadams.dev/zettelkasten/:path*"
}
@bramses
bramses / gitLastDay.js
Last active July 25, 2022 01:25
Note: this must be run in the repo that has the `.git` folder (https://www.bramadams.dev/projects/gitting-git-commits-for-your-work-journal)
import moment from "moment";
import { spawn } from "child_process";
import * as dotenv from "dotenv";
dotenv.config();
const OWNER = process.env.OWNER || process.argv[2];
const REPO = process.env.REPO || process.argv[3];
const AUTHOR = process.env.AUTHOR || process.argv[4];
const GH_URL = `https://github.com/${OWNER}/${REPO}/commit/`;
// npm install wavesurfer.js
import React, { useState, useEffect, useRef } from "react";
const formWaveSurferOptions = (ref) => ({
container: ref,
waveColor: "#eee",
progressColor: "#0178FF",
cursorColor: "OrangeRed",
barWidth: 3,
barRadius: 3,