- On the Raspberry Pi
pip install nanpy
pip install pygame
##### Testing the different components separately before building the whole system | |
## THINGS YOU NEED TO SET UP | |
1. On the Raspberry Pi | |
```bash | |
pip install nanpy | |
pip install pygame | |
``` |
if your ps3 controller just vibrates when connecting to the retropie, or when your ps3 controller does not connect via bluetooth, this writedown might help you.
Since no exact description did work for me, I decided to write it down, what I did based on other descriptions, in order to get it to work.
version: '3.1' | |
services: | |
database: | |
image: "postgres" | |
restart: "always" | |
environment: | |
- POSTGRES_USER=postgres | |
- POSTGRES_PASSWORD=postgres | |
- POSTGRES_DB=db |
CREATE TABLE IF NOT EXISTS public.persons( | |
person_id INT PRIMARY KEY, | |
first_name VARCHAR, | |
last_name VARCHAR | |
); | |
CREATE TABLE IF NOT EXISTS public.transactions( | |
transaction_id INT PRIMARY KEY, | |
transaction_amount INT, |
def nested_loop_join(left: List[dict], right: List[dict], on: str, how: str) -> List[dict]: | |
""" Nested loop JOIN strategy: For every row in outer, find matching one in inner | |
If left/right JOIN and there's no match on inner, return outer. Else, skip | |
Params: | |
left (list<dict>) - List of dicts representing one relation | |
right (list<dict>) - List of dicts representing the other relation | |
on (string) - The key in the relations to JOIN on | |
how (string) - The JOIN (left, right, inner) |
def hash_func(ind: int, mp_size: int): | |
""" A simple hash function (uses a version of the mid-square method and modulus) | |
Params: | |
ind (int) - The index to hash | |
mp_size (int) - The size of the hash map | |
Returns: | |
key (int) - The hashed output | |
""" |
def inner_merge_join(left: List[dict], right: List[dict], on: str) -> List[dict]: | |
""" (Sort) Merge JOIN: Sort both by JOIN key. Loop through both simulateneously. | |
If matching, advance inner till no match. If no match, advance the smaller attr | |
INNER JOIN only implemented | |
""" | |
output = [] | |
sorted_left = sorted(left, key = lambda dic: dic[on]) |
import re | |
keywords = r"(SELECT|WHERE|FROM|AND|OR|NOT)" | |
patterns = [ | |
(keywords, lambda scanner, token: {"token_type": "keyword", "token": token}), | |
(r"[a-zA-Z_][a-zA-Z_0-9]*", lambda s, t: {"token_type": "name", "token": t}), | |
(r"\*", lambda s, t: {"token_type": "all_cols","token": t}), | |
(r">=|>|<=|<|=", lambda s, t: {"token_type": "operator","token": t}), | |
(r"[-+]?\d*\.\d+", lambda s, t: {"token_type": "float","token": t}), | |
(r"\d+", lambda s, t: {"token_type": "integer","token": t}), |