chore: remove dev-data/ dir
This commit is contained in:
		
							parent
							
								
									033a8aaaef
								
							
						
					
					
						commit
						5c3774be0a
					
				
					 5 changed files with 41 additions and 117 deletions
				
			
		|  | @ -1,19 +0,0 @@ | ||||||
| --- |  | ||||||
| title: Network_fundamentals |  | ||||||
| tags: [networks, network-protocols] |  | ||||||
| created: Saturday, August 03, 2024 |  | ||||||
| --- |  | ||||||
| 
 |  | ||||||
| # Network fundamentals |  | ||||||
| 
 |  | ||||||
| > A network is a system that allows computing devices to communicate and |  | ||||||
| > exchange information with each other. |  | ||||||
| 
 |  | ||||||
| In order for devices to be able to communicate they must share a common |  | ||||||
| **communication protocol**. |  | ||||||
| 
 |  | ||||||
| A protocol specifies **rules determining how information is to be exchanged**. |  | ||||||
| (Simply connecting two devices is not sufficient for them to be able to |  | ||||||
| communicate, they must have a shared language.) |  | ||||||
| 
 |  | ||||||
| The nodes of a network are called [hosts](Network_hosts.md). |  | ||||||
|  | @ -1,35 +0,0 @@ | ||||||
| --- |  | ||||||
| title: Peer_to_peer_network |  | ||||||
| tags: [networks] |  | ||||||
| created: Friday, August 09, 2024 |  | ||||||
| --- |  | ||||||
| 
 |  | ||||||
| # Peer to peer network |  | ||||||
| 
 |  | ||||||
| A decentralised network model where each participant (peer) acts as both a |  | ||||||
| client and a server. |  | ||||||
| 
 |  | ||||||
| Resources are shared directly between peers rather than being coordinated via a |  | ||||||
| server. |  | ||||||
| 
 |  | ||||||
| Under a server architecture, multiple requests are made from different hosts for |  | ||||||
| resources. The server manages this load and is in control of what is being |  | ||||||
| shared, to whom, and when. With P2P there is no central authority equivalent to |  | ||||||
| this. Each peer both shares and consumes resources and in this sense is both a |  | ||||||
| client and a server. |  | ||||||
| 
 |  | ||||||
| A practical example of this is [torrenting](Torrenting.md) - an applicaton of |  | ||||||
| P2P technology to file sharing. |  | ||||||
| 
 |  | ||||||
| ## Benefits |  | ||||||
| 
 |  | ||||||
| - Decentralisation, no central authority, also means no single point of failure. |  | ||||||
| - Scalable: the network capacity grows with the number of users (contrast |  | ||||||
|   servers) |  | ||||||
| - Efficiency: idle resources of peers are put to use |  | ||||||
| - Improved performance for popular content |  | ||||||
| 
 |  | ||||||
| ## Drawbacks |  | ||||||
| 
 |  | ||||||
| - Security: potential for malicious peers and content |  | ||||||
| - Inconsistent availability of resources |  | ||||||
|  | @ -1,45 +0,0 @@ | ||||||
| --- |  | ||||||
| title: Turing_Completeness |  | ||||||
| tags: [theory-of-computation, Turing] |  | ||||||
| created: Friday, September 13, 2024 |  | ||||||
| --- |  | ||||||
| 
 |  | ||||||
| # Turing Completeness |  | ||||||
| We know that a [Turing machine](Turing_machines.md) is a theoretical construct |  | ||||||
| of a computer that: |  | ||||||
| 
 |  | ||||||
| > contains mutable state, executes sequences of simple instructions that read |  | ||||||
| > and write that state, and can pick different execution paths depending on the |  | ||||||
| > state (via conditional branch instructions.) |  | ||||||
| 
 |  | ||||||
| A Turing Complete (TC) system is a system that abides by, or can be reduced to, |  | ||||||
| the above description. |  | ||||||
| 
 |  | ||||||
| TC also serves as a _definition of computability_ and provides a formal basis |  | ||||||
| for conceiving of computation at a theoretical level. |  | ||||||
| 
 |  | ||||||
| All Turing Complete systems are functionally equivalent. This means they can |  | ||||||
| simulate each other given enough time and memory. Similarly a TC system can in |  | ||||||
| principle perform any computation that any other programmable computer can |  | ||||||
| perform. This is true for _other_ TC systems and also those that are not TC |  | ||||||
| however the inverse doesn't hold: a non-TC system cannot emulate a TS system. |  | ||||||
| For instance a calculator cannot do what a TC smart phone can do. But a smart |  | ||||||
| phone can act as a calculator. |  | ||||||
| 
 |  | ||||||
| Completeness applies to the hardware of computers as well as their software. |  | ||||||
| 
 |  | ||||||
| Turing Completeness is the theoretical basis of the practical concept of a |  | ||||||
| "general-purpose computer": a general-purpose computer is such because it is |  | ||||||
| TC - it can in theory compute anything that is computable. |  | ||||||
| 
 |  | ||||||
| Most modern programming languages are Turing Complete in that they can, in |  | ||||||
| theory, be used to compute anything that is computable. |  | ||||||
| 
 |  | ||||||
| What about Universal Turing Machines eh? |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| Within the [hierarchy of the OS](./Basic_model_of_the_operating_system.md), the |  | ||||||
| kernel acts as the primary mediator between the hardware (CPU, memory) and |  | ||||||
| [user](./User_Space.md) [processes](Processes.md). Let's look at each of its |  | ||||||
| responsibilities in greater depth: |  | ||||||
| 
 |  | ||||||
							
								
								
									
										10
									
								
								src/models/entry.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/models/entry.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | ||||||
|  | from typing import List, TypedDict | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Entry(TypedDict): | ||||||
|  |     title: str | ||||||
|  |     last_modified: str | ||||||
|  |     size: str | ||||||
|  |     tags: List[str] | ||||||
|  |     links: List[str] | ||||||
|  |     body: str | ||||||
|  | @ -1,9 +1,8 @@ | ||||||
| from sql.create_tables import ( | import sqlite3 | ||||||
|     CREATE_BACKLINKS_TABLE, | from typing import Optional | ||||||
|     CREATE_ENTRIES_TABLE, | 
 | ||||||
|     CREATE_ENTRIES_TAGS_TABLE, | from sql.create_tables import tables | ||||||
|     CREATE_TAGS_TABLE, | from src.models.entry import Entry | ||||||
| ) |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class SqliteService: | class SqliteService: | ||||||
|  | @ -11,17 +10,31 @@ class SqliteService: | ||||||
|         self.connection = connection |         self.connection = connection | ||||||
|         self.cursor = connection.cursor() |         self.cursor = connection.cursor() | ||||||
| 
 | 
 | ||||||
|  |     def __query(self, sql, errorMessage: Optional[str] = None): | ||||||
|  |         try: | ||||||
|  |             self.cursor.execute(sql) | ||||||
|  |             self.connection.commit() | ||||||
|  | 
 | ||||||
|  |         except sqlite3.Error as sqliteError: | ||||||
|  |             raise Exception(f"ERROR SQLite: {sqliteError}") | ||||||
|  | 
 | ||||||
|  |         except Exception as e: | ||||||
|  |             if errorMessage: | ||||||
|  |                 raise Exception(f"ERROR {errorMessage}: {e}") | ||||||
|  |             else: | ||||||
|  |                 raise Exception(f"ERROR Problem with database operation: {e}") | ||||||
|  | 
 | ||||||
|     def create_tables(self): |     def create_tables(self): | ||||||
|         tables = [ |         for table in tables: | ||||||
|             CREATE_ENTRIES_TABLE, |             self.__query( | ||||||
|             CREATE_TAGS_TABLE, |                 table["create_statement"], f"Problem creating table {table['name']}" | ||||||
|             CREATE_BACKLINKS_TABLE, |             ) | ||||||
|             CREATE_ENTRIES_TAGS_TABLE, |         print("INFO Created tables") | ||||||
|         ] |  | ||||||
|         for create_statement in tables: |  | ||||||
|             self.cursor.execute(create_statement) |  | ||||||
| 
 | 
 | ||||||
|         self.connection.commit() |     def truncate_tables(self): | ||||||
| 
 |         for table in tables: | ||||||
|         self.cursor.execute("SELECT name FROM sqlite_master WHERE type='table';") |             self.__query( | ||||||
|         print(self.cursor.fetchall()) |                 f"DELETE FROM {table['name']}", | ||||||
|  |                 f"Problem truncating table {table['name']}", | ||||||
|  |             ) | ||||||
|  |         print("INFO Cleared tables") | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 thomasabishop
						thomasabishop