Skip to content

Instantly share code, notes, and snippets.

View jaanli's full-sized avatar
🍉
Hungry

Jaan Lı 李 PhD jaanli

🍉
Hungry
View GitHub Profile

i tell my mother in law: don't trust people's intentions; everyone will tell you how they have the best of intentions.

instead, i tell her what i tell my students of data thinking: learn to listen to what people have to say - then see what they do. then think about how much you can understand of the numbers and incentives at play behind what they say and what they do.

trust people's actions. you can see and verify them for yourself:

do they listen to your puerile humor, your poop jokes? Your bad accents?

do they tell you what's on their mind, through tears of laughter or fear, and trust that the risk of pooping your party is worth having a difficult conversation?

Keybase proof

I hereby claim:

  • I am jaanli on github.
  • I am thejaan (https://keybase.io/thejaan) on keybase.
  • I have a public key whose fingerprint is 979F 2FA9 730B E3DA 3648 0671 BE63 0220 3150 FB60

To claim this, I am signing this object:

@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 September 16, 2024 14: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}