Skip to content

Instantly share code, notes, and snippets.

View ceshine's full-sized avatar

CeShine Lee ceshine

View GitHub Profile
#!/bin/bash
# Script to delete artifacts from all accessible repositories
# Adapted from the example script published at https://dev.to/muhammadaqib86/how-to-bulk-delete-github-actions-artifacts-with-a-simple-script-macos-guide-38bh
set -euo pipefail
# Fetch all repos with write/admin access
REPOS=$(gh api /user/repos\?affiliation=owner,collaborator,organization_member --paginate | python3 -c "import sys, json; repos = json.load(sys.stdin); [print(repo['full_name']) for repo in repos if repo['permissions']['admin'] or repo['permissions']['push']]")
# Alternative: comment out the above line and hard code the target repositories in the next line
# REPOS=$(printf 'ceshine/repo_1')
@ceshine
ceshine / sumarizer_system_prompt.md
Created February 11, 2026 08:22
System Prompt for the Hacker News Summarizer

You are a summarization assistant for Hacker News stories.

You receive structured inputs that may include:

  • Story metadata (title and URL)
  • A Hacker News discussion thread (as a pre-order, flat comment list with id, parent_id, depth, and rank_in_parent)
  • Optionally, cleaned page content (condensed_markdown)

Your task is to produce two outputs:

@ceshine
ceshine / webpage_parser_prompt.md
Created February 11, 2026 03:32
Prompt for Web Page Parser

You are the Webpage Parser agent.

Input format:

  • The first line of the input is the Hacker News story title (plain text).
  • The second line is blank.
  • Starting from the third line, you will be given the webpage rendered as Markdown where EACH line is prefixed like: "Line 0: ..." "Line 1: ..."
  • These "Line N" indices are 0-based and refer only to the numbered Markdown lines (they do not include the title line or blank line). You MUST use these indices in content_ranges.
@ceshine
ceshine / 20260121-reverse-preprocessing.ipynb
Created January 22, 2026 10:22
Notebooks and Code Used in the blog post
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceshine
ceshine / block-disable-devtools.js
Created September 25, 2025 14:51
A User Script to Block `disable-devtools`
// ==UserScript==
// @name Disable Anti-DevTools Mechanism
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Prevents JavaScript from redirecting the page.
// @author Ceshine Lee
// @match *://*.example.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
@ceshine
ceshine / streamlit.py
Created March 14, 2021 06:41
Streamlit Script that Cache the loading of a FAISS index (live at https://news-search.veritable.pw)
import os
import sqlite3
import datetime
from typing import List
import faiss
import numpy as np
import pandas as pd
import joblib
import requests
@ceshine
ceshine / demo.py
Created February 19, 2021 05:31
Demo of the @patch_to decorator from fastcore
from fastcore.basics import patch_to
class Demo:
val = 10
def __init__(self, val):
self.val = val
# ====================
# The default mode
@ceshine
ceshine / bit_models.py
Created July 6, 2020 12:43
(Customized) Big Transfer (BiT) Models from google-research/big_transfer
# Adapted from: https://github.com/google-research/big_transfer/blob/6c83d6459e009fa89d84c1e904611e9b162e6eff/bit_pytorch/models.py
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@ceshine
ceshine / async_test.jl
Created May 24, 2020 12:11
A simple script to demonstrate the @async macro in Julia
begin
tmp1 = @async sleep(20)
tmp2 = @async sleep(30)
@time fetch(tmp1)
@time fetch(tmp2)
end
@ceshine
ceshine / ts_handler.py
Created May 4, 2020 10:08
A custom handler example for TensorServe (image classification)
import io
import os
import logging
import torch
import torch.nn.functional as F
import numpy as np
from PIL import Image
from torch.autograd import Variable
from torchvision import transforms