Skip to content

Instantly share code, notes, and snippets.

View ntflix's full-sized avatar

Felix ntflix

View GitHub Profile
#!python3.9
from time import sleep
from typing import Optional
import requests
from urllib.parse import urlencode
HEADERS = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Content-Type": "application/x-www-form-urlencoded",
"Origin": "https://www.oracleofbacon.org",
@ntflix
ntflix / line_number_generator.sh
Created May 7, 2021 08:56
Bash script to create a .txt copy with line numbers and a header of the filename of every .py file recursively down in a directory
for file in `find .`;
do if [ "${file: -3}" == ".py" ];
then echo -e $file\\n >> $file.txt && echo -e "`nl -ba $file`" >> $file.txt;
fi;
done
@ntflix
ntflix / Text game.py
Created December 26, 2020 16:40
Text game.py
# Skeleton Program code for the AQA A Level Paper 1 Summer 2019 examination
# this code should be used in conjunction with the Preliminary Material
# written by the AQA Programmer Team
# and me lol ©
# developed in the Python 3.5.1 programming environment
import random
import pickle
import os
@ntflix
ntflix / Text game.py
Created December 26, 2020 16:40
Text game.py
# Skeleton Program code for the AQA A Level Paper 1 Summer 2019 examination
# this code should be used in conjunction with the Preliminary Material
# written by the AQA Programmer Team
# and me lol ©
# developed in the Python 3.5.1 programming environment
import random
import pickle
import os
@ntflix
ntflix / Text game.py
Created December 26, 2020 16:40
Text game.py
# Skeleton Program code for the AQA A Level Paper 1 Summer 2019 examination
# this code should be used in conjunction with the Preliminary Material
# written by the AQA Programmer Team
# and me lol ©
# developed in the Python 3.5.1 programming environment
import random
import pickle
import os
@ntflix
ntflix / Text game.py
Created December 26, 2020 16:40
Text game.py
# Skeleton Program code for the AQA A Level Paper 1 Summer 2019 examination
# this code should be used in conjunction with the Preliminary Material
# written by the AQA Programmer Team
# and me lol ©
# developed in the Python 3.5.1 programming environment
import random
import pickle
import os
@ntflix
ntflix / maze.py
Created December 9, 2020 12:04
maze.py
from modules.data_structures.graph.graph import Graph
from modules.data_structures.maze.maze.maze_protocol import MazeProtocol
from modules.data_structures.maze.maze_cell.maze_cell import MazeCell
from typing import Dict, Tuple
class Maze(MazeProtocol):
"""The protocol for any Maze object to conform to.
Args:
@ntflix
ntflix / Adjacency matrix.py
Created August 19, 2020 12:00
Adjacency matrix.py
from typing import List
"""
Adjacency Matrix
1. Create a matrix A of size NxN and initialise it with zero.
2. Iterate over each given edge of the form (u,v) and assign 1 to A[u][v]. Also, If graph is undirected then assign 1 to A[v][u].
"""
class Graph:
adjacencyMatrix: List[List]
@ntflix
ntflix / Using a Dictionary.py
Created August 19, 2020 11:57
Using a Dictionary.py
import csv
import enum
def average(numbers: list):
average: float = 0
for number in numbers:
average += number
average /= len(numbers)
@ntflix
ntflix / Breadth First Search.py
Created August 19, 2020 11:44
Breadth First Search.py
graph: dict = {
"A": {"colour": "White", "neighbours": ["B", "D", "E"]},
"B": {"colour": "White", "neighbours": ["A", "D", "C"]},
"C": {"colour": "White", "neighbours": ["B", "G"]},
"D": {"colour": "White", "neighbours": ["A", "B", "E", "F"]},
"E": {"colour": "White", "neighbours": ["A", "D"]},
"F": {"colour": "White", "neighbours": ["D"]},
"G": {"colour": "White", "neighbours": ["C"]}
}