Skip to content

Instantly share code, notes, and snippets.

@hitamu
hitamu / script.js
Last active May 6, 2025 13:21
Search Saved Post on LinkedIn
javascript:(async()=>{const s=ms=>new Promise(r=>setTimeout(r,ms));const a=async()=>{let p=0,a=0;while(a<10){window.scrollTo(0,document.body.scrollHeight);await s(2000);const c=document.body.scrollHeight;c===p?a++:(a=0,p=c)}};const t=(t,e)=>{const n=t.split(/\s+/);return n.length<=e?t:n.slice(0,e).join(" ")+"..."};const e=()=>{const p=[];document.querySelectorAll("[data-chameleon-result-urn]").forEach(e=>{const u=e.getAttribute("data-chameleon-result-urn"),r=`https://www.linkedin.com/feed/update/${u}`,c=e.querySelector(".entity-result__content-summary"),t=c?.innerText?.trim(),l=e.querySelector(".entity-result__content-actor"),a=l?.innerText?.trim().split("\n")[0],n=e.querySelector(".entity-result__content-actor a"),o=n?.href||"#";t&&a&&p.push({a,u:o,c:t,l:r})});return p};const o=p=>{const e=JSON.parse(localStorage.getItem("li_p")||"[]"),c=[...e,...p],u=Array.from(new Map(c.map(p=>[p.l,p])).values());localStorage.setItem("li_p",JSON.stringify(u));return u};const f=(p,s)=>s?p.filter(p=>p.c.toLowerCase().include
@hitamu
hitamu / run.js
Created December 25, 2024 03:57
JavaScript for Automation: summarize text with LLM
function run(input) {
const key = 'your-key-here';
return summarizeText(input[0], key)
}
function summarizeText(text, apiKey) {
const app = Application.currentApplication();
app.includeStandardAdditions = true;
const endpoint = 'https://api.openai.com/v1/chat/completions';
@hitamu
hitamu / init.vim
Last active February 22, 2020 07:41
init.vim
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.config/nvim/plugged')
" Declare the list of plugins.
Plug 'christoomey/vim-tmux-navigator'
Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'tpope/vim-liquid'
Plug 'jparise/vim-graphql'
Plug 'scrooloose/nerdtree'
Plug 'vim-airline/vim-airline'