I put IPFS on a Raspberry Pi and so should you!
- Raspberry Pi 3 B: $43
- Micro SD card: $11
- [Raspberry Pi charger](ht
| from flask import Flask, jsonify, request | |
| from flask_sqlalchemy import SQLAlchemy | |
| import uuid | |
| app = Flask(__name__) | |
| db = SQLAlchemy(app) | |
| app.config['SECRET_KEY']='secret' | |
| app.config['SQLALCHEMY_DATABASE_URI']='sqlite:///app.db' |
| class HttpCrudRequests { | |
| async get(url) { | |
| const res = await fetch(url) | |
| const data = await res.json() | |
| return data | |
| } | |
| async post(url, post) { | |
| const res = await fetch(url, { |
| # From the book, effective python 2nd edition item 37 | |
| from collections import defaultdict | |
| from dataclasses import dataclass, field | |
| from typing import List, Dict | |
| @dataclass | |
| class Grade: | |
| weight: int |
| #!/usr/bin/env python3 | |
| class SimpleCalculator: | |
| def sum(self, a, b): | |
| """ Function to add two integers """ | |
| if isinstance(a, int) and isinstance(b, int): | |
| return a + b | |
| else: | |
| return "ERROR" |
| #Copyright 2022 Fabian Bosler | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation | |
| # files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, | |
| # modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom | |
| # the Software is furnished to do so, subject to the following conditions: | |
| # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | |
| # Software. |
| from flask import Flask | |
| from flask_sqlalchemy import SQLAlchemy | |
| import os | |
| import graphene | |
| from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField | |
| from flask_graphql import GraphQLView | |
| ################################# | |
| app = Flask(__name__) | |
| app.debug = True |
| use rust_gpiozero::*; | |
| use std::thread::sleep; | |
| use std::time::Duration; | |
| fn main() { | |
| println!("Hello, world!"); | |
| let led = LED::new(18); | |
| loop{ |
| // Simple gist to test parallel promise resolution when using async / await | |
| function promiseWait(time) { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve(true); | |
| }, time); | |
| }); | |
| } |
| #!/usr/bin/python3 | |
| import argparse | |
| import logging | |
| import subprocess | |
| import os | |
| import tempfile | |
| from tempfile import mkstemp | |
| import configparser | |
| import gzip |