Skip to content

Instantly share code, notes, and snippets.

View hchiam's full-sized avatar
🔍
▸ Front-end web dev

Howard Chiam hchiam

🔍
▸ Front-end web dev
View GitHub Profile
@hchiam
hchiam / bookmarklet.js
Created October 30, 2023 01:44 — forked from ukaserge/bookmarklet.js
Bookmark-let to summarize a web page using GPT-3 - written by GPT-3
javascript: (function () {
var text = document.body.innerText;
var spl = text.split(" ");
if (spl.length > 3000) {
text = spl.slice(0, 3000).join(" ");
}
fetch('https://api.openai.com/v1/completions', {
method: 'POST',
headers: {
import openai
openai.api_key = "YOUR API KEY HERE"
model_engine = "text-davinci-003"
chatbot_prompt = """
As an advanced chatbot, your primary goal is to assist users to the best of your ability. This may involve answering questions, providing helpful information, or completing tasks based on user input. In order to effectively assist users, it is important to be detailed and thorough in your responses. Use examples and evidence to support your points and justify your recommendations or solutions.
<conversation history>
User: <user input>
@hchiam
hchiam / AutoML_data_preparation_AIA023.ipynb
Created November 30, 2021 02:51 — forked from yufengg/AutoML_data_preparation_AIA023.ipynb
Notebook for preparing a CSV for Google Cloud AutoML Vision
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hchiam
hchiam / migration-example-redirect.md
Last active March 18, 2019 01:18
Migrate from RawGit to something else! (redirect)
@hchiam
hchiam / migration-example.md
Last active March 18, 2019 01:41
Migrate from RawGit before it shuts down sometime after October 2019!
@hchiam
hchiam / clean_code.md
Created September 21, 2018 15:48 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@hchiam
hchiam / nes.py
Created April 18, 2017 14:41 — forked from karpathy/nes.py
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
"""
A bare bones examples of optimizing a black-box function (f) using
Natural Evolution Strategies (NES), where the parameter distribution is a
gaussian of fixed standard deviation.
"""
import numpy as np
np.random.seed(0)
# the function we want to optimize