I put IPFS on a Raspberry Pi and so should you!
- Raspberry Pi 3 B: $43
- Micro SD card: $11
- [Raspberry Pi charger](ht
#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. |
#!/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" |
# 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 |
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 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' |
// Basic Types | |
let id: number = 5 | |
let company: string = 'Traversy Media' | |
let isPublished: boolean = true | |
let x: any = 'Hello' | |
let ids: number[] = [1, 2, 3, 4, 5] | |
let arr: any[] = [1, true, 'Hello'] | |
// Tuple |
//https://www.digitalocean.com/community/tutorials/how-to-add-login-authentication-to-react-applications | |
//By default, react-router-dom is now ^6.0.2. | |
//Below are the significant changes for the tutorial to use the new version of react-router-dom | |
//Line 14 -> Switch has been replaced with Routes | |
//Line 29/34 -> Switch has been replaced with Routes (2) | |
import React, { useState }from "react"; | |
import "./App.css"; |
import datetime as dt | |
import os | |
import motor | |
from beanie import Document, Indexed, PydanticObjectId, init_beanie, operators | |
from fastapi import FastAPI, Response, status | |
from pydantic import BaseModel | |
app = FastAPI() |
<form name="contact" netlify netlify-honeypot="bot-field" hidden> | |
<input type="text" name="name" /> | |
<input type="email" name="email" /> | |
<textarea name="message"></textarea> | |
</form> |