Skip to content

Instantly share code, notes, and snippets.

View jaanli's full-sized avatar
🍉
Hungry

Jaan Lı 李 PhD jaanli

🍉
Hungry
View GitHub Profile
@jaanli
jaanli / Listening to Articles Read Out Loud to You Using Artificial Intelligence.md
Created May 23, 2024 13:18
The best screen reader apps for consuming written content on the go (iPhone / Android apps, etc)

If you want to read (i.e. listen to!) content that is:

  1. On the web: use the Microsoft Edge browser read aloud feature (https://www.microsoft.com/en-us/edge/features/read-aloud)
  1. Words in a PDF: use the Elevenlabs app:
@jaanli
jaanli / copy.sh
Last active May 5, 2024 13:04
Large language model (LLM) helper script to copy context into long-context-window language models to improve their ability to help users with programming tasks.
#!/bin/bash
# Instructions:
# 0. Install prerequisites using a package manager: `brew install tree rectangle maccy` (`tree` is a command line utility for transmitting the directory structure to large language models in a compressed format; `rectangle` is a utility for managing screen state and having a LLM on the left of the screen and a code editor/interactive development environment like Jupyter Lab or Visual Studio Code on the right of the screen using keyboard shortcuts; `maccy` is for having a keyboard shortcut to display clipboard history, as there are few solutions like https://colab.research.google.com/github/jaanli/language-model-notebooks/blob/main/notebooks/getting-started.ipynb that enable saving of previous prompts and code in accessible ways using keyboard shortcuts!)
# 1. Copy and paste the contents of this bash script into a file: `code /usr/local/bin/copy.sh`
# 2. Make this new file executable: `chmod a+x /usr/local/bin/copy.sh`
# 3. Test it in a directory, by running `copy.sh`, which should
@jaanli
jaanli / absorbing-information.md
Created April 13, 2024 16:57
Patterns for reducing information overload.
@jaanli
jaanli / research-patterns.md
Last active April 13, 2024 11:48
Research patterns for finding information online

Information is often behind paywalls, behind artificial intelligence interfaces that require payment, and going to the source is often required to advance basic science and biomedical research.

Here are simple workflows tested over the years for accessing information:

graph TB
A[Can I access plain text content that contains the information needed to satisfy my intent?] --> B(<a href='https://web.archive.org'>Wayback Machine</a>)
A --> C(<a href='https://archive.is'>archive.is</a>)
A --> D(<a href='https://libgen.rs'>Library Genesis</a>)
A --&gt; E[<a href="https://bing.com">Bing Cached Pages</a>Search on Bing, click arrow by result, click 'Cached']
@jaanli
jaanli / accounting-with-large-language-models.md
Last active May 16, 2024 16:27
Cents & Sensibility: How to do accounting 101 in one hour with large language models

Cents & Sensibility: The Ledger Luminaries' Revolution

I'm scared to account; scared of statements of business dealings, credits and debits, and tracking of all this money-related stuff. Scared of reciting these transaction histories, and yet reckoning with these computations and enumerations is as deathly certain as taxes.

It is silly that this problem has not been solved given fancy new technology like AI and large language models. It's also silly how much big institutions skim off the top, like 1.5–3.5% per credit card transaction, and our expanding web of subscriptions to Substacks, Youtubes and the like that become more numerous and Medusa-like the harder they are to track, aggregate, categorize, and analyze across instutitions. I'm also scared of Mint.com (I used it for many years) as they broker our data, but still need the help of software and technology to manage money. This feels like a data problem that should have been solved long ago 🤯

So the goal here was to spend a few hours on a weekend t

@jaanli
jaanli / automatically_delete_wandb.ai_projects.test.js
Created February 21, 2024 20:04
Delete Weights and Biases (wandb.ai) projects automatically. Use with `WANDB_EMAIL="myemail" WANDB_PASSWORD="mypassword" npx playwright test automatically_delete_wandb.ai_projects.test.js
import { test, expect } from '@playwright/test';
test('Delete W&B Projects', async ({ page }) => {
// Navigate to the login page and log in
await page.goto('https://wandb.ai/login');
await page.getByPlaceholder('name@work-email.com').fill(process.env.WANDB_EMAIL);
await page.getByPlaceholder('your password').fill(process.env.WANDB_PASSWORD);
await page.click('text=Log In');
// Wait for navigation to ensure login is complete
import torch
import torch.nn.functional as F
import time
from flash_attn import flash_attn_qkvpacked_func
# Ensure torch supports bf16 on the current device; CUDA support for bf16 might be device-dependent
assert torch.cuda.is_bf16_supported(), "CUDA device does not support bf16."
# Data Preparation
batch_size = 1
@jaanli
jaanli / latexit-template-keynote-whitney.tex
Last active May 15, 2020 06:56
LaTeXiT template for settings that look okay with Keynote and Whitney font
\documentclass[10pt]{article}
\usepackage[usenames]{color} %used for font color
\usepackage{amssymb} %maths
\usepackage{amsmath} %maths
\usepackage{mathtools}
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
% TABLES
\usepackage{booktabs}
\usepackage{array}
@jaanli
jaanli / 2017-06-21-tea-talk-development.md
Last active December 3, 2018 20:38
Quick overview of snapshot of dev environment / workflow

Towards a better mac development environment in 2018

Progress, perspectives, & new beginnings.

Advice: Install everything. Go all-in on all the suggested tools for a week, then see what sticks. Start using all of them at once. There's a large 'activation energy' to switching tools but it is worth the up-front investment for a lifetime of saved milliseconds on everyday tasks like switching directories, etc.

Useful tools:

  • brew cask: install most desktop applications brew cask install spotify evernote simplenote dropbox vlc slack 1password skim caffeine mactex skype anaconda google-chrome alfred iterm2 flux spectacle rescuetime sublime-text macbreakz little-snitch
@jaanli
jaanli / Dockerfile
Created June 6, 2017 18:36
Dockerfile for dotfiles with vim + tmux + c++ dev environment & private github ssh key support. Using dotfiles from https://github.com/altosaar/dotfiles
# Fixed ubuntu version
FROM ubuntu:16.04
# Install Ruby and Rails dependencies
RUN apt-get update && apt-get install -y \
tmux \
gdb \
gcc \
g++ \
python \