Skip to content

Instantly share code, notes, and snippets.

View gto76's full-sized avatar

Jure Šorn gto76

View GitHub Profile

This document was generated by ChatGPT after it was provided with the Dictionary section of the Comprehensive Python Cheatsheet and grilled about the formatting of the generated test sections with approximately 10 queries. The rest were generated using the '<title>?' query. Descriptions of the libraries were generated by asking for one sentence description of each. Unlike the previous test where it was asked to generate already existing sections from the cheatsheet, here it was asked to generate sections on libraries that are missing in the original.

Machine Learning

SciPy

A library for scientific computing and technical computing.

import scipy
@gto76
gto76 / python-cheathseet-by-gpt.md
Last active July 24, 2023 12:53
Comprehensive Python Cheatsheet up to Datetime, generated by ChatGPT after it was provided with the Dictionary section and grilled about the formatting for some time.

Comprehensive Python Cheatsheet

This version of the Comprehensive Python Cheatsheet was generated by ChatGPT after it was provided with the Dictionary section of the original and grilled about the formatting of the generated String and Set sections with approximately 10 queries. The rest were generated using the '<title>?' query.

List

<list> = []                                   # Creates an empty list.
<list> = [<el>, ...]                          # Creates a list with elements.
<el> = <list>[<index>]                        # Accesses the element at index. Raises IndexError if out of bounds.
<list>[<index>] = <el>                        # Assigns element at index. Raises IndexError if out of bounds.
artist title type release_date relevant_tracks link
David Bowie Station to Station album 1976-01-23 https://rateyourmusic.com/release/album/david-bowie/station-to-station/
The Residents The Third Reich 'N Roll album 1976-02-01 https://rateyourmusic.com/release/album/the-residents/the-third-reich-n-roll/
Ramones The Blitzkrieg Bop!! / Havana Affair single 1976-02 https://rateyourmusic.com/release/single/ramones/the-blitzkrieg-bop-havana-affair/
Doctors of Madness Late Night Movies, All Night Brainstorms album 1976-03 1, 5, 7 https://rateyourmusic.com/release/album/doctors-of-madness/late-night-movies-all-night-brainstorms/
Pere Ubu Final Solution / Cloud 149 single 1976-03 https://rateyourmusic.com/release/single/pere-ubu/final-solution-cloud-149/
Eddie And The Hot Rods Writin' on the Wall / Cruisin' (In the Lincoln) single 1976-03-18 https://rateyourmusic.com/release/single/eddie-and-the-hot-rods/writin-on-the-wall-cruisin-in-the-lincoln/
Debris' Static Disposal album 1976-04-10 https://rateyourmusi
@gto76
gto76 / explorer.py
Last active January 18, 2022 03:35
A tool for finding good function (and its parameters) that determines how fast numbers move in asterisk and numbers game from coroutines example in [Comprehensive Python Cheatsheet](https://gto76.github.io/python-cheatsheet/#coroutines).
#!/usr/bin/env python3
#
# Usage: python3 explorer.py
#
# A tool for finding a good function (and its parameters) that determines how fast numbers move
# in asterisk and numbers game from coroutines example in Comprehensive Python Cheatsheet.
# (https://gto76.github.io/python-cheatsheet/#coroutines)
#
# Script needs a settings.py file in the same directory. It contains different "settings" or
# "presets". A setting is comprised of whidth, height, parameters and a function that
@gto76
gto76 / pin_guesser.py
Last active July 5, 2020 01:21
A little Python script that helps you remember a forgotten PIN number
#!/usr/bin/env python3
#
# Usage: ./pin_guesser.py
# Tool that helps you remember a PIN code.
# It starts by giving you suggestions containing the first two decimals, then middle
# two and last two. Then it takes the answers and generates the suggestions
# containing the first three decimals, followed by the last three and finally all four.
# You answer to the proposed PIN number with 'j' for yes and 'f' for no.
# At the end it prints out all the affirmative answers.
# It is also saving the answers along the way into pickle files, so they can
@gto76
gto76 / sinthesizer.py
Created January 31, 2019 13:41
Simple music sinthesizer
# pip3 install simpleaudio
import wave, struct
import simpleaudio as sa
from collections import namedtuple
from math import pi, sin
Settings = namedtuple('Setting', 'n_channels sample_width f')
S = Settings(n_channels=1, sample_width=2, f=44100)
SECONDS = 4
@gto76
gto76 / tip.html
Created April 14, 2018 19:46
Draws a tip bubble using JS
<html>
<head>
<script src="d3.v3.min.js" charset="utf-8"></script>
<style>
.bkgrnd {
fill-opacity: 0.5
}
.temp-text {
font-family: Arial, sans-serif;
}
@gto76
gto76 / mandelbrot.py
Created April 14, 2018 19:43
Draws an ASCII mandelbrot set
#!/usr/bin/python3
#
# Usage: man.py
#
import numpy as np
import sys
ASCII_GREYSCALE = " .:-=+*#%@"
@gto76
gto76 / pub_puzzle.py
Created April 14, 2018 19:41
Tries to solve the problem of: 1 1 1 = 6, 2 2 2 = 6, ...
#!/usr/bin/env python3
#
# Usage: pub.py [NUM]
# Tries to solve the problem of:
# 1 1 1 = 6
# 2 2 2 = 6
# 3 3 3 = 6
# ...
import sys
@gto76
gto76 / spiral.py
Created April 14, 2018 13:40
Draws spiral of the prime numbers
#!/usr/bin/python3
#
# Usage: spiral.py [MATRIX_HEIGHT]
#
# Draws spiral of the prime numbers. Numbers are arranged in a spiral like this:
# 17 16 15 14 29
# 18 5 4 3 28
# 19 6 1 2 27
# 20 7 8 9 26
# 21 22 23 24 25