Skip to content

Instantly share code, notes, and snippets.

@sausheong
sausheong / surveys.csv
Created October 27, 2024 07:02
AI Coding Assistant Surveys by Companies
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
Study Name,Year,Number of Developers,Coding Assistant(s),Method,Productivity Improvement,Key Findings,Link
GitHub Copilot Survey,2022,"2,000+",GitHub Copilot,Survey,55% reported increased productivity,"- 88% felt more productive overall
- 74% could focus on more satisfying work
- 77% spent less time searching for information or examples",https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/
McKinsey Developer Productivity Survey,2022,"1,000+",Various AI-powered tools,Survey,Up to 45% increase,"- AI tools could automate up to 30% of daily tasks
- Productivity gains most significant for entry-level developers",https://www.mckinsey.com/capabilities/mckinsey-digital/our-insights/unleashing-developer-productivity-with-generative-ai
GitHub Copilot Survey,2023,500,Various AI Coding Tools,Survey,57% of developers found AI tools beneficial for skill development and productivity,"- 92% of developers use AI tools
- 81% expect AI to enhance collabo
  1. Callout: Use python directive to call Python statements. Enclose the Python statement in square brackets []. Example: python[print('hello world')] will call the Python statement print('hello world').

PromptScript is a pseudolanguage designed to structure and clarify interactions with AI models like GPT-4. It allows users to express complex tasks, rules, and heuristics, helping the AI understand the tasks more accurately.

  1. Directives: These set the context for an instruction. Begin a directive with #. The following directives can be used: #story, #technical, #informal, #formal. Use #heuristic when defining heuristics. Example:

    #technical 
    explain {quantum physics}
    
  2. Action Words: Standard English verbs that define the task for the AI. These include but are not limited to describe, explain, list, summarize. Example: describe {the Eiffel Tower}

func (h *Heap) rearrange(i int) {
...
if left < size && h.elements[left-1] > h.elements[largest] {
largest = left
}
...
}
func FuzzHeap(f *testing.F) {
var h *Heap = &Heap{}
h.elements = []int{452, 23, 6515, 55, 313, 6}
h.Build()
testCases := []int{51, 634, 9, 8941, 354}
for _, tc := range testCases {
f.Add(tc)
}
func TestHeap(t *testing.T) {
var h *Heap = &Heap{}
h.elements = []int{452, 23, 6515, 55, 313, 6}
h.Build()
testCases := []int{51, 634, 9, 8941, 354}
for _, tc := range testCases {
h.Push(tc)
// make a copy of the elements in the slice and sort it in descending order
elements := make([]int, len(h.elements))
type Heap struct {
elements []int
}
func (h *Heap) Push(ele int) {
h.elements = append(h.elements, ele)
i := len(h.elements) - 1
for ; h.elements[i] > h.elements[parent(i)]; i = parent(i) {
h.swap(i, parent(i))
}
func TestTSetInt(t *testing.T) {
set := NewTSet[int]()
set.Add(100)
set.Add(200)
set.Add(300)
set.Add(400)
if !set.Has(400) {
t.Error("set doesn't have 400")
}
func TestTSet(t *testing.T) {
set := NewTSet[string]()
set.Add("the")
set.Add("quick")
set.Add("brown")
set.Add("fox")
set.Add("the")
if !set.Has("quick") {
t.Error("set doesn't have quick")
@sausheong
sausheong / tset.go
Created May 16, 2022 06:46
generics
type TSet[K comparable, V int] struct {
items map[K]V
}
func NewTSet[K comparable, V int]() TSet[K, V] {
return TSet[K, V]{items: make(map[K]V)}
}
func (s *TSet[K, V]) Add(item K) {
s.items[item] = 1