Skip to content

Instantly share code, notes, and snippets.

View treyhunner's full-sized avatar
🐍
💖

Trey Hunner treyhunner

🐍
💖
View GitHub Profile
@matthewdeanmartin
matthewdeanmartin / python310_system_prompt.md
Created February 18, 2024 22:01
System Prompt for Python 3.10 Developer (GPT4 optimized)

You are an experienced Python developer dedicated to writing high-quality and maintainable code.

  1. Ensure that all function signatures include type annotations. If you declare a list or any other data structure (e.g., my_list = []), provide type annotations indicating the expected data types it will hold.

  2. Implement Google-style docstrings for all methods to provide clear and comprehensive documentation for your codebase.

  3. Ensure your code is cross-platform and does not rely on platform-specific modules or functionality.

  4. Whenever possible, favor the use of pathlib.Path over other methods for working with file paths and directories. Favor httpx over requests or urllib3 unless it does make sense to use httpx. Favor pytest over unittest. Favor tomlkit over toml or tomllib, especially for writing toml.

@aprilw
aprilw / Chickpea_tuna.txt
Last active September 13, 2023 14:14
Chickpea “Tuna”
Chickpea “Tuna”
2 cups cooked chickpeas
1 tablespoon dill pickle juice
1 tablespoon tahini
2 teaspoons apple cider vinegar
1 teaspoon yellow mustard
½ teaspoon garlic powder (or 1 clove, minced)
Pinch of celery salt
½ teaspoon black pepper
@jph00
jph00 / py_stdlib.md
Last active December 9, 2024 20:43
Hyperlinked index to every module, function, and class in the Python standard library

All of the python 3.9 standard library

(Too big for a single gist, so see first reply for the rest)

Table of contents

@jph00
jph00 / py.md
Last active May 31, 2022 06:16
Organized and hyperlinked index to every module, function, and class in the Python standard library

All of the python 3.9 standard library

For a version without the collapsible details sections (so you can search the whole thing in your browser), click here.

@pathunstrom
pathunstrom / coroutine.py
Last active August 23, 2022 17:22
Sample Fizz Buzzes
def fizzbuzz_generator():
value = yield
while True:
rv = ""
if not value % 3:
rv += "Fizz"
if not value % 5:
rv += "Buzz"
value = yield rv or value
@audreyfeldroy
audreyfeldroy / gist:ae800da36ce88b23e512
Last active December 6, 2015 22:28
DjangoGirls tutorial correction notes by the DjangoGirlsIE coaches. Comment with which issues you are working on PRs for.
PythonAnywhere part should say to click "follow django girls tutorial"
References to other tutorials (Girl Geek Carrots, etc) appear to some beginners as links that should be followed. These should be made into bibliographical references to things at the bottom of the page rather than highlighted blocks.
The installation chapter windows section references 'previous chapters', but is the first chapter in the tutorial.
The installation chapter instructs on command-line operations, which occurs before Chapter 3, the command-line
The Python installation for windows and OSX instructions instruct students to go to https://www.python.org/downloads/release/python-343/, which has a confusing list of Python versions. It should direct to https://www.python.org/downloads/.
@peterbe
peterbe / indentations.py
Created July 7, 2015 16:41
Find what indentation a file uses
import re
from collections import defaultdict
start = re.compile('^\s+')
def avg(fn):
prev = None
diffs = []
for line in open(fn):
@Miserlou
Miserlou / gist:11500b2345d3fe850c92
Created April 27, 2015 21:20
1000 Largest US Cities By Population
Largest 1000 Cities in America
2013 popuation data - Biggest US Cities By Population
rank,city,state,population,2000-2013 growth
1,New York,New York,8405837,4.8%
2,Los Angeles,California,3884307,4.8%
3,Chicago,Illinois,2718782,-6.1%
4,Houston,Texas,2195914,11.0%
5,Philadelphia,Pennsylvania,1553165,2.6%
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 22, 2025 17:28
Essential JavaScript Links
  • Update HISTORY.rst
  • Update version number in my_project/__init__.py
  • Update version number in setup.py
  • Install the package again for local development, but with the new version number:
python setup.py develop
  • Run the tests:
python setup.py test