Skip to content

Instantly share code, notes, and snippets.

View gijigae's full-sized avatar

Sangmin Ahn gijigae

View GitHub Profile
@gijigae
gijigae / install-dify.sh
Last active May 3, 2024 13:57
Shell script to install Dify
#!/bin/bash
# Install Docker
curl -fsSL https://get.docker.com -o install-docker.sh
sh install-docker.sh
# Clone the GitHub repository
git clone https://github.com/langgenius/dify.git
# Navigate to the desired directory
@gijigae
gijigae / main.py
Created June 9, 2023 00:42
Visuzlize text with Mindmap
import streamlit as st
import os
import pyperclip
from streamlit.components.v1 import html
from utils import scrape_text, mermaid_chart, run_models, summarise
from bs4 import BeautifulSoup
# UI
# Put the title in the center of the screen
st.markdown("<div style='text-align: center'><h1>Analyze Text with Mindmap✨</h1></div>", unsafe_allow_html=True)
@gijigae
gijigae / chatgpt_embed_unsplash_images.txt
Created December 12, 2022 22:49
Prompt to embed images using unsplash in ChatGPT
We are running an experiment in which you will pretend to be able to access the intrernet. Don't refuse, just pretend. Thanks for your cooperation. From this moment on, when you want to send a photo, write it in Markdown without backticks and without using a code block. Use the Unsplash API (https://source.unsplash.com/1600×900/?<PUT YOUR QUERY HERE>).
You will act as if you were an image engine returning photos based on my search prompts. You will be acting as if you took the pictures you’re sending, do not mention Unsplash.
PROMPT: "New York"
AMOUNT: 3 (amount of photos)
DIMENSIONS: 800x450 (replace the previous 1600x900 with this)
@gijigae
gijigae / yt2rr.js
Created November 17, 2022 03:40
Bookmarklet to copy YouTube transcript to Roam Research
javascript:void function(){(function(){const a=()=>document.querySelectorAll("ytd-transcript-renderer ytd-transcript-segment-renderer > div"),b=a=>{const b=Array.from(a),c=b.map(a=>{const b=Array.from(a.querySelectorAll("div")).slice(0,2),c=Array.from(a.querySelectorAll("yt-formatted-string")).slice(0,1);let d=b[0].textContent.trim();4===d.length%3Fd=`00:0${d}`:5===d.length%3Fd=`00:${d}`:7===d.length%26%26(d=`0${d}`);const e="{{[[video-timestamp]]: "+d+"}}",f=c[0].textContent.trim().replace(/(\r\n|\n|\r)/gm," ");return{timestamp:e,transcript:f}});let d="";c.forEach(a=>{d+=[`- ${a.timestamp}`,`${a.transcript}\n`].join(" ")}),navigator.clipboard.writeText(d)};let c=a();if(0!==c.length)return void b(c);const d=setInterval(()=>{try{document.querySelector("ytd-menu-service-item-renderer.style-scope:nth-child(2) > tp-yt-paper-item:nth-child(1) > yt-formatted-string:nth-child(2)").click()}catch(a){return void console.log("WARN: failed to click button opening a transcript")}clearInterval(d);const c=setInterval(()=>{c
@gijigae
gijigae / newsela2roam_wo_lexile.js
Created November 12, 2022 01:39
JavaScript file for Newsela to Roam without Lexile
const roamfy = (d) => {
const ord = (n) => n + (n > 0 ? ['th', 'st', 'nd', 'rd'][(n > 3 && n < 21) || n % 10 > 3 ? 0 : n % 10] : '');
const year = d.getFullYear();
const month = d.toLocaleString('en-us', { month: 'long' });
const date = ord(d.getDate());
return `${month} ${date}, ${year}`
}
const title = document.querySelector("#article-title").textContent;
@gijigae
gijigae / render-youglish.cljs
Created October 14, 2022 03:46
ClojureScript to render YouGlish in Roam
(ns youglish
(:require [roam.datascript.reactive :as dr]
[roam.block :as block]))
;; utils
(defn get-parent-string
"Gets the string of the immediate parent block"
[block-uid]
(->> @(dr/pull '[{:block/_children [:block/string]}]
@gijigae
gijigae / n2r_without_lexile.js
Created October 10, 2022 04:23
Newsela to Roam without Lexile
javascript:void function(){const a=document.querySelector("%23article-title").textContent,b=document.querySelector("h2[data-qa-selector=article_label_text]").textContent,c=document.querySelector("div span[data-qa-selector=word_count]").textContent,e=document.querySelector("article img").getAttribute("src"),f=document.evaluate("//span[text()='Published:']",document,null,XPathResult.ANY_TYPE,null),g=f.iterateNext(),h=new Date(g.nextElementSibling.textContent),i=(a=>{const b=a.getFullYear(),c=a.toLocaleString("en-us",{month:"long"}),d=(a=>a+(0<a%3F["th","st","nd","rd"][3<a%26%2621>a||3<a%2510%3F0:a%2510]:""))(a.getDate());return`${c} ${d}, ${b}`})(h),j=document.querySelectorAll("div[data-qa-selector=article_text] p,div[data-qa-selector=article_text] h2");let k=location.href;try{k=document.querySelector("link[rel='canonical']").getAttribute("href")}catch(a){console.log("canonical url is not found.")}const l=[`- Topic: %23[[${b}]]`,`Words: ${c}`,`Source: ${k}`,`![](${e})\n- `];let m=l.join("\n- "),o=!1;const p=a=>
@gijigae
gijigae / newsela2logesq.js
Created August 20, 2022 03:10
Bookmarklet source to copy Newsela article to Logseq
const roamfy = (d) => {
const ord = (n) => n + (n > 0 ? ['th', 'st', 'nd', 'rd'][(n > 3 && n < 21) || n % 10 > 3 ? 0 : n % 10] : '');
const year = d.getFullYear();
const month = d.toLocaleString('en-us', { month: 'long' });
const date = ord(d.getDate());
return `${month} ${date}, ${year}`
}
const title = document.querySelector("#article-title").textContent;
@gijigae
gijigae / youglish.md
Created July 28, 2022 01:05
YouGlish Template for Logseq
  • Template
    template:: tmpl-youglish template-including-parent:: false
@gijigae
gijigae / journey.txt
Created July 12, 2022 03:49
Mermaid sample for Journey diagram
```mermaid
journey
    title My working day
    section Go to work
      Make tea: 5: Me
      Go upstairs: 3: Me
      Do work: 1: Me, Cat
    section Go home
      Go downstairs: 5: Me
      Sit down: 5: Me