Skip to content

Instantly share code, notes, and snippets.

View WizzyGeek's full-sized avatar
🚤
I am. Speed!

WizzyGeek

🚤
I am. Speed!
  • localhost:2004
View GitHub Profile
@WizzyGeek
WizzyGeek / project_x.py
Created January 24, 2022 07:39
my first calculator thingy
import decimal
# version check
import sys
from decimal import Decimal
if sys.version_info[0] != 3:
try:
print("This script requires Python 3")
except SyntaxError as err:
raise err
from pyautogui import *
import pyautogui
import time
import keyboard
import pygetwindow as gw
import sys
import math
import win32api
screencenter = 1980 / 2, 1080 / 2
@WizzyGeek
WizzyGeek / clah.c
Created February 27, 2023 07:25
Some C code I wrote, maybe useful for switching instead of dumbass switch-case calling
#include<stdio.h>
int map(int *arr, int (*(*foo)(int))(int), int choose) {
printf("%d", foo(choose)(arr[0]));
}
int barfoo(int x) {
return x - 1;
}
int foobar(int x) {
@WizzyGeek
WizzyGeek / array_ops.c
Last active July 27, 2023 03:55
Array stuff
// Array operations
// Search
// Insert
// Traverse
// Update
#include<string.h>
#include<stdio.h>
// O(n) time
#include"stdlib.h"
#include"stddef.h"
#include"stdio.h"
typedef struct {
int *arr;
size_t len;
} Array;
Array iota(size_t len) {
#include"stdio.h"
void iota(int *arr, int len) {
for (int i = 0; i < len; i++) {
arr[i] = i;
}
}
int main() {
int a[4][4];
#include"stdio.h"
#include"string.h"
size_t bisect(char **a, int len, char *elem) {
size_t hi = len - 1;
size_t lo = 0;
size_t mid;
while (1) {
mid = (hi + lo) >> 1;
#include<bits/stdc++.h>
int argmin(std::vector<int> &a, int from) {
int m = a.at(from);
int mi = from;
for (int i = from; i < a.size(); i++) if (a[i] < m) { m = a[i]; mi = i; }
return mi;
}
void bubble_sort(std::vector<int> &a) {
@WizzyGeek
WizzyGeek / insert_bench.cpp
Last active February 22, 2024 15:46
Insertion sort bench
#include<bits/stdc++.h>
void insertion_sort(std::vector<int> &a) {
for (int i = 1; i < a.size(); i++) {
int b = a[i];
int j = i - 1;
for (; j >= 0 && b < a[j]; j--) {
a[j + 1] = a[j];
}
a[j + 1] = b;
@WizzyGeek
WizzyGeek / merge_bench.cpp
Created January 20, 2024 11:58
Merge sort bench
#include<bits/stdc++.h>
void merge(std::vector<int> &a, int l, int mid, int r) {
int p1 = l;
int p2 = mid + 1;
std::vector<int> ret(r - l + 1);
int i = 0;
while (p1 <= mid && p2 <= r) ret[i++] = a[p1] < a[p2] ? a[p1++] : a[p2++];