Skip to content

Instantly share code, notes, and snippets.

View Gaming32's full-sized avatar

Josiah Glosson Gaming32

  • Wisconsin, USA
  • 05:55 (UTC -05:00)
View GitHub Profile
@Gaming32
Gaming32 / InteractiveMenu.java
Last active February 18, 2022 02:05
Interactive Console Menu in Java using JLine
package io.github.gaming32;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import org.fusesource.jansi.Ansi;
import org.jline.keymap.BindingReader;
import org.jline.keymap.KeyMap;
@Gaming32
Gaming32 / shelve_explore.py
Created June 6, 2021 18:30
An interactive Python shelf explorer (only compatible with Linux currently) (requires the "simple-term-menu" library from PyPI)
import argparse
import ast
import shelve
import time
from simple_term_menu import TerminalMenu
parser = argparse.ArgumentParser()
parser.add_argument('database')
@Gaming32
Gaming32 / joyctrl.py
Created December 12, 2020 20:01
Control your mouse with your game controller!
import clr
import pyautogui
import pygame
from pygame.locals import *
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
from System.Drawing import Point
from System.Windows.Forms import Cursor
@Gaming32
Gaming32 / stable_checker.py
Last active October 30, 2020 16:23
Simple sorting stability checker
from __future__ import annotations
from typing import Any, Callable, Generator, Iterable, List, Literal, Sequence, Union
import random
class IntegerWrapper(int):
key: Any = None
# def __init__(self, val, key) -> None:
# super().__init__(val)
# self.key = key
@Gaming32
Gaming32 / listvis.py
Last active October 25, 2020 18:58
Python list visualizer
import sys
import threading
import time
if sys.platform[:3] == 'win':
import winsound
import numbers
def get_slice_indices(sl: slice, leng: int):
sl_indices = sl.indices(leng)
@Gaming32
Gaming32 / add_parentheses.py
Last active October 13, 2020 19:30
Adds parentheses to Python expressions (and prettifies them)
import ast
import sys
binary_operator_classes = {
ast.Add: '+',
ast.Sub: '-',
ast.Mult: '*',
ast.Div: '/',
ast.Pow: '**',
@Gaming32
Gaming32 / turtle_commands.py
Created September 22, 2020 22:02
Turtle drawing program
"""
MIT License
Copyright (c) 2020 Gaming32
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Gaming32
Gaming32 / bfdl.py
Last active September 5, 2020 16:48
Breadth-First directory listing
import os
def list_directory(root):
tosearch = [root]
reached = set()
while tosearch:
for item in tosearch[:]:
tosearch.remove(item)
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* T-Rex runner.
* @param {string} outerContainerId Outer containing element id.
* @param {!Object=} opt_config
* @constructor
* @implements {EventListener}
@Gaming32
Gaming32 / win32positioner.py
Last active August 14, 2020 17:08
Let's you control which windows are Always on Top (Windows only, requires pywin32 library)
import sys
import time
import win32con
import win32gui
def main(args):
if len(args) < 1:
input('Press enter when ready to select window...')