Skip to content

Instantly share code, notes, and snippets.

View TheVoxcraft's full-sized avatar

Jonas TheVoxcraft

  • University i Oslo (USIT)
View GitHub Profile
@TheVoxcraft
TheVoxcraft / jackett.py
Created April 9, 2021 14:50
jackett.py for qBittorrent (fixed)
# VERSION: 3.6
# AUTHORS: Diego de las Heras (ngosang@hotmail.es)
# CONTRIBUTORS: TheVoxcraft
# ukharley
# hannsen (github.com/hannsen)
import json
import os
import xml.etree.ElementTree
from urllib.parse import urlencode, unquote
@TheVoxcraft
TheVoxcraft / lspclient.py
Created January 31, 2024 17:30
Simple LSPClient for Python
import os
# Define the path to the Python script you want to analyze
# path of this file
my_path = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(my_path, 'main.py')
import subprocess
import json
class LSPClient:
@TheVoxcraft
TheVoxcraft / telnetserver.py
Created December 25, 2015 11:22
Python Socket Telnet Chat Room (Python 3.5.1)
import socket
import sys
from _thread import *
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clients = []
host = ''
port = 23
chat = ""
print("\n"*50)
# check ping and return ping
from pythonping import ping
import time
import re
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
@TheVoxcraft
TheVoxcraft / 1pastebot.py
Last active November 19, 2021 23:45
PasteBin Bot with Pastebin API 1.6
#Python 3.4
import random
import string
import time
from pastebin import PastebinAPI
x = PastebinAPI()
DEV_KEY1 = '475b38cdfbba7a92d8bde6c56adfb241' #primary key
@TheVoxcraft
TheVoxcraft / AVLTree.py
Created September 7, 2021 10:38
Python implementation of AVL self-balancing BST
# AVL Tree by vox and kritjo
class AVLTree:
root = None
def left_rotate(self, z):
y = z.right
T = y.left
y.left = z
z.right = T
z.height = 1 + max(self.height(z.left), self.height(z.right))
@TheVoxcraft
TheVoxcraft / findingPrimesMulti.c
Created March 17, 2021 16:32
My multithreaded implementation in C of finding primes, 10x faster than PyPy implementation .
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <time.h>
#include <pthread.h>
#include <math.h>
struct thread_args{
int start_number;
int end_number;
import multiprocessing as mp
import time
#max number to look up to
max_number = 200_000
#four processes per cpu
num_processes = mp.cpu_count() * 6
def chunks(seq, chunks):
size = len(seq)
@TheVoxcraft
TheVoxcraft / Vector3.py
Created August 8, 2017 14:41
Vector3 Class in python3
import math
class Vector3:
x = 0
y = 0
z = 0
def __init__(self, _x, _y, _z):
self.x = _x
self.y = _y
self.z = _z
def __add__(self, other):
boolean trykketRiktig;
boolean tapt;
long startTid;
int G1=2;
int G2=3;
int G3=4;
int G4=6;
int G5=7;
int G6=8;