Skip to content

Instantly share code, notes, and snippets.

View ntcho's full-sized avatar
🚀
Ready

Nathan Cho ntcho

🚀
Ready
View GitHub Profile
@ntcho
ntcho / README.md
Last active March 9, 2026 18:14
Gemini Non-Pro Model Alert

Gemini Non-Pro Model Alert

A userscript designed to provide a visual cue when the active Google Gemini model is not set to "Pro".

The script continuously monitors the .model-picker-container element on the Gemini web interface. If the selected model text deviates from "Pro", it dynamically injects an orange outline directly into the model picker button. This is useful for users who want to ensure they are always interacting with a specific model tier before submitting a prompt.

How it works

  • Target Element: Monitors .model-picker-container using a MutationObserver.
  • Condition: Checks if the innerText of the container does not equal "Pro".
@ntcho
ntcho / README.md
Last active March 9, 2026 18:06
Gemini Title Updater

Gemini Title Updater

A userscript that dynamically updates the browser tab and window title to match the active conversation in Google Gemini.

By default, the Gemini web interface does not consistently reflect the specific conversation name in the document title. This script continuously monitors the DOM for the .gds-title-m element and updates the page title to the format: [Conversation Title] | Gemini.

Use Cases

  • Identifiable Tabs: Easily distinguish between multiple active Gemini conversations in your browser.
  • Productivity Tracking: Enables time-tracking and productivity logging tools that rely on window titles (such as Chronoid, ActivityWatch, or RescueTime) to accurately categorize and record the specific tasks you are working on.
/*
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.css
1. Append the following to the file
2. Restart VS Code (ignore the integrity warning)
From: https://github.com/microsoft/vscode/issues/519#issuecomment-3691806331
*/
#workbench\.view\.explorer *[role="treeitem"] {

Fix for using Gemini in screenpipe

The issue stems from the underlying coding agent Pi not properly supporting Gemini API endpoint with OpenAI compatibility. You'll see 400 errors with no details.

1. Setup Gemini in screenpipe

  1. Create new AI preset (Settings > AI > Create Preset)
  2. Click 'Custom'
  3. Add https://generativelanguage.googleapis.com/v1beta/openai for the 'Custom URL'
  4. Add your API key and choose your model
@ntcho
ntcho / recover-vscode.js
Last active April 11, 2025 20:24
Recover files from VSCode file history
// Find and recover the first/last entry from VSCode edit history
import fs from "fs-extra";
import os from "os";
import path from "path";
const recoverDir = "/path/to/recover"
// Path to search for history files
const prevRoot = "file://" + recoverDir;
@ntcho
ntcho / matrix_chain_multiplication.py
Created May 7, 2023 23:54
Matrix chain multiplication problem in Python
# Matrix Chain Multiplication Optimization
# size of the matrix in the matrix chain
# A_1 is a p[0] by p[1] matrix, A_2 is a p[1] by p[2] matrix
p = [10, 20, 12, 17, 22, 19, 50]
# length of the matrix chain + 1
matrix_size = len(p)
# initialize matrix with zeros
@ntcho
ntcho / git-merge-repos.md
Created October 9, 2017 15:48
Merging git repositories
// at the copying repo
// move the files into another folder to prevent merge conflicts
git add .
git commit -m "Project move in progress"

// on the destionation repo
// the name `temp` could be changed for anything else
// locations are like in the shell, but the `\` should be replaced to `/`
git remote add temp *location*
@ntcho
ntcho / git-merge-repos.md
Created October 9, 2017 15:48
Merging git repositories

// at the copying repo // move the files into another folder to prevent merge conflicts git add . git commit -m "Project move in progress"

// on the destionation repo // the name temp could be changed for anything else // locations are like in the shell, but the \ should be replaced to / git remote add temp location git fetch temp

@ntcho
ntcho / LoopPython.py
Last active April 22, 2017 14:26
Python Loops
for i in range(0, 6):
print i
j = 0
while j < 5:
print j
j += 1
k = 0
while True:
@ntcho
ntcho / LoopC++.cpp
Created April 10, 2017 00:38
C++ Loops
int main() {
int i = 0, j = 0, k = 0;
// for statement
for (i = 0; i < 5; i++) {
print(i);
}
// while statement
while (j < 5) {
print(j++);