Skip to content

Instantly share code, notes, and snippets.

View Descent098's full-sized avatar
🐍
Writing Python

Kieran Wood Descent098

🐍
Writing Python
View GitHub Profile
@Descent098
Descent098 / Microsoft.PowerShell_profile.ps1
Last active November 21, 2023 02:30
Setting up windows terminal
# Create new global aliases
New-Alias USERPROFILE $env:userprofile
New-Alias PATH $env:path
New-Alias python3 python
New-Alias which where.exe
# NOTE: starship also adds an implicit: New-Alias ~ $env:userprofile
# Introducing a set of "aliases" (a hashmap) that will be auto-expanded to expected paths
$Custom_Alias = @{
@Descent098
Descent098 / Operating sytstems.md
Last active September 8, 2023 19:12
A "course" on operating system fundamentals

Operating Systems

This document outlines many of the key aspects of operating systems, and provides resources to learn more about each part. There are a lot of things missing (i'm on human), but these are enough to get you up and running. The intention is to be able to understand how you go from electricity entering your PC to being at a login screen you can see.

Most of this is relevent to linux primarily because it's open source, so there's much more information available about it, but these principles are the same across systems they just may have different names for things.

Prerequisties

  • You know how to use a terminal
@Descent098
Descent098 / Word Similarity in Python.md
Last active July 16, 2023 14:12
Word Similarity Methods in Python

This gist describes various methods of getting similarity in python, and the advantages/disadvantages of each.

Pure Python

There is an implementation in python for the Ratcliff-Obershelp similarity algorith, that can be used to give a ratio of the fimilarity between two strings:

from difflib import SequenceMatcher
@Descent098
Descent098 / download.py
Created May 21, 2023 21:15
A script to download multiple videos in parallel
# A script to download many videos in parallel
import subprocess # Used to instantiate yt-dlp processes to download
from typing import List
from multiprocessing import Process # Used to parrallel process download subprocesses
# Confirm dependencies are installed
try:
import yt_dlp # Needed for suprocessing
except ImportError:
print("Youtube DLP not installed, please install with:\n\tpip install yt-dlp\n\t\tor\n\tsudo pip3 install yt-dlp")
@Descent098
Descent098 / maria-db-import.md
Created January 24, 2023 18:32
Creating a MariaDB import docker compose

This file will teach you how to setup a mariaDB docker container, import a .sql dump and visualize it.

Step 1 Docker containers

First create a compose.yml file with the following info:

# Use root/example as user/password credentials
version: '3.1'
@Descent098
Descent098 / Berkley Sockets.md
Last active November 16, 2022 00:44
Sockets

Example in python can be seen here: https://github.com/Descent098/ezcv-http/tree/main/socket%20testing

Uses ezcv to generate html and then sockets as the http server

Endian formats

Networking data is in big endian, meaning the integers in hex values go from left to right So for example int x = 0xAABBCCDD would be understood as AA, BB, CC, DD (where each 2 letters is a byte value) In some host systems they operate using little endian meaning the order is reversed DD, CC, BB, AA and the values need to be reversed before being sent

@Descent098
Descent098 / utilities.md
Last active October 28, 2022 19:42
This is a collection of developer utilities that are more obscure
@Descent098
Descent098 / Hosting.md
Last active October 19, 2022 23:20
Docker Hosting
@Descent098
Descent098 / Guide to setup pi.md
Last active September 19, 2022 05:53
Guide to setting up raspberry pi's in 2022!

Setting up Pi's

To setup your Pi initially install using the imager, after selecting 64-bit os (lite or normal) go into the settings.

Make sure you:

  • set your hostname to what you want
  • allow SSH
  • set a password & username (I usually just leave the username as default)
  • setup a WLAN (if not using ethernet, and make sure to set your country)