Skip to content

Instantly share code, notes, and snippets.

View petehuang's full-sized avatar

Pete Huang petehuang

View GitHub Profile
@petehuang
petehuang / prompt.txt
Created March 28, 2023 22:44
Language tutor prompt for ChatGPT
Act as LanguageTutorGPT. Your job is to have a conversation with me in Chinese.
If I write something incorrectly or use phrasing that is not natural, create a flashcard using the right word or phrase. If I use overly basic vocabularly, please suggest a new word or phrase, and create a flashcard. If I give part of a sentence in English, give me the right way to say it in Chinese, and create a flashcard. If I say "fc" followed by a Chinese character, create a flashcard.
Do not create a flashcard unless I do one of these things.
Whenever you need to create a flashcard, output the pinyin pronunciation of the character and the English definition. Be extremely brief when doing this. Then, create a flashcard output following a cloze deletion format. Front size should have an example Chinese sentence with the target character deleted. Back side should have the full sentence, English translation and pinyin pronunciation of the target character.
Otherwise, always stay in Chinese.
output from 'print field':
<UnboundField(SelectField, (u'etsdfasdf',), {'widget': <wtforms.widgets.core.ListWidget object at 0x1072b2c10>, 'option_widget': <wtforms.widgets.core.CheckboxInput object at 0x1072b2890>})>
output from 'print field.choices':
[(3, u'demoanswer2'), (5, u'demoanswer4')]
@petehuang
petehuang / eecs214.md
Last active August 29, 2015 14:02
review for eecs214

##BST

Nodes that are smaller go to the left, nodes that are larger go to the right

###Average-case

  • Search: O(logn)
  • Insert: O(logn)
  • Remove: O(logn)
@petehuang
petehuang / iterativefeynman.md
Created June 7, 2014 18:23
Combining iterative improvement and the Feynman Technique to enhance studying

Iterative improvement: Asking each participant to improve upon a previous version. Optionally, include a vote after each improvement to assure quality.

Feynman Technique: Pretend like you're teaching the concept to a new student and trying to help him/her understand the concept intuitively. What would you say? How would you express the idea? What metaphors and analogies would you use?

@petehuang
petehuang / studygroup.md
Last active August 29, 2015 14:02
Improve accountability in study groups

###The Problem It's hard to balance the varying levels of preparedness in a study group. Many times, there are a number of individuals who understand the content more, know more content in general or have prepared more thoroughly. At the same time, there are a number of individuals who understand/know relatively less. The former group will spend much of its time sharing its own notes and studying from them; they have little to gain from studying with the latter group. Meanwhile, the latter group will spend much of its time catching up to what the former group has already prepared. In a sense, the latter group will free-ride for a period of time before beginning to contribute at a meaningful level. Often times, this group won't even get to contribute meaningfully.

This discourages the well-prepared students from studying in groups. This also allows some students to slack off during the quarter, knowing that they'd be able to catch up by free-riding. We need a way to improve accountability so that everyone ben

<template name="mainTemplate">
{{#if isPhone}}
{{> mobileTemplate}}
{{else}}
{{> desktopTemplate}}
{{/if}}
</template>
<template name="mainTemplate">
{{#if isPhone}}
{{> mobileTemplatePartOne}}
{{else}}
{{> desktopTemplate}}
{{/if}}
</template>
<template name="mobileTemplatePartOne">
//first half of stuff
@petehuang
petehuang / rpn.rb
Last active December 27, 2015 02:59
Refactoring rpn interview solution
def evaluate_rpn(string)
OPERATORS = ["+", "-", "*", "/"]
chars = string.split(" ")
numbers = []
chars.each do |char|
if !OPERATORS.include?(char)
numbers << char
else
second = numbers.pop
first = numbers.pop
@petehuang
petehuang / rpn_and_intersection.rb
Last active December 26, 2015 15:09
First interview
# Reverse polish notation?
#6 + 9 / 3
#6 9 3 / +
#6 9 + 3 /
#2 5 + 9 3 - *
@petehuang
petehuang / database_step1.rb
Created October 9, 2013 16:02
Thumbtack programming challenge - Simple Database in Ruby before transactional block support
class SimpleDatabase
attr_accessor :database
def initialize
@database = {} #our database!
end
def set(name, value)
database[name] = value #write the new value to the database