All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

Login


All New Login
's Avatar

kristofer

Joined 1714567308

Recently created
Least recently created
Recently updated
Least recently updated
All gists 106
kristofer's Avatar

kristofer / FastAPI_auth_example.py

0 likes
0 forks
1 files
Last active 1718312876
1 from fastapi import FastAPI, Depends, HTTPException, status, Header
2 from sqlalchemy import create_engine, Column, String, Integer
3 from sqlalchemy.ext.declarative import declarative_base
4 from sqlalchemy.orm import sessionmaker
5 from keycove import encrypt, decrypt, hash, generate_token
6 from sqlalchemy.orm import Session
7
8 app = FastAPI()
9
10 SQLALCHEMY_DATABASE_URL = "sqlite:///db.sqlite3"
kristofer's Avatar

kristofer / AsyncWithFASTAPI.md

0 likes
0 forks
1 files
Last active 1718287788

Useful, from FastAPI, description of Async and Await within concurrency in Python

Concurrency and async / await

kristofer's Avatar

kristofer / O'Reilly Research

0 likes
0 forks
1 files
Last active 1718136145
the items traced by reading the 3-part series.

The original Three articles.

  • https://www.oreilly.com/radar/what-we-learned-from-a-year-of-building-with-llms-part-i/
  • https://www.oreilly.com/radar/what-we-learned-from-a-year-of-building-with-llms-part-ii/
  • https://www.oreilly.com/radar/what-we-learned-from-a-year-of-building-with-llms-part-iii-strategy/

And then the Rabbit Holes.

  • https://www.microsoft.com/en-us/research/blog/the-power-of-prompting/ Microsoft's ideas on prompt engr rather than fine-tunning.
  • https://www.linkedin.com/blog/engineering/generative-ai/musings-on-building-a-generative-ai-product LinkedIn's App work description.
kristofer's Avatar

kristofer / guidance-example.py

0 likes
0 forks
1 files
Last active 1718132229
1 import guidance
2 gpt35 = guidance.models.OpenAI("gpt-3.5-turbo")
3
4 import re
5 from guidance import gen, select, system, user, assistant
6
7 @guidance
8 def plan_for_goal(lm, goal: str):
9
10 # This is a helper function which we will use below
kristofer's Avatar

kristofer / PyObjects.py

0 likes
0 forks
1 files
Last active 1718111211
1 print("1 Hello World!")
2
3 class HelloWorld:
4 def main(self):
5 print("2 Hello World!")
6
7 obj = HelloWorld()
8 obj.main()
9
10 # What do you MEAN Python is an Object Oriented Language?
kristofer's Avatar

kristofer / symboltable2.md

0 likes
0 forks
1 files
Last active 1716315910

describe how you would use python's dict data structure to build a symbol table for a small language compiler

TinyLlama

In a small language compiler like Python, the goal is to convert an input program into a bytecode that can be executed by an interpreter. This bytecode is then translated into machine code (CPU instructions) and executed by a CPU, or run directly in a virtual machine (VM). The intermediate representation for this process is called a symbol table,

kristofer's Avatar

kristofer / symboltable1.md

0 likes
0 forks
1 files
Last active 1716315925

describe how you would use python's dict data structure to build a symbol table for a small language compiler

Phi3

Building a symbol table using Python's dictionary data structure for a small language compiler involves several steps. The symbol table will be used to keep track of variables, their types, and scopes during the compilation process. Here's how you can implement it:

  1. Define basic classes
kristofer's Avatar

kristofer / What's running on a port?

0 likes
0 forks
1 files
Last active 1715607468
for macOS

To find what's running on Port#

# macos
sudo lsof -i :<PortNumber>
# should return a PID as first number
kill -9 <PID>
kristofer's Avatar

kristofer / docker boot.md

0 likes
0 forks
1 files
Last active 1715607326

Get Spring/jhipster running in Docker container

On the mac you'll need to download Docker Desktop

This provides the docker commands on the Mac

Not sure if you need to download and install docker-compose or not....

./mvnw package -Pprod verify jib:dockerBuild

kristofer's Avatar

kristofer / Python OOP Sample

0 likes
0 forks
1 files
Last active 1715362413
1 # here is a very simple example of python OOP
2
3 # normal hello-world
4 print("1 Hello World!")
5
6 # an OOP version
7
8 class HelloWorld:
9 def main(self):
10 print("2 Hello World!")
Newer Older

Powered by Opengist ⋅ Load: 162ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano Português Русский Türkçe Українська 中文 繁體中文