Skip to content

Instantly share code, notes, and snippets.

View bradmartin333's full-sized avatar

Brad Martin bradmartin333

View GitHub Profile
@bradmartin333
bradmartin333 / bigyoshi.py
Created August 10, 2022 17:03
Circuit Python spamming
# spam big yoshi
time.sleep(2)
kbd.press(Keycode.WINDOWS)
kbd.release_all()
time.sleep(0.25)
kbd_layout.write("chrome")
time.sleep(0.25)
kbd.press(Keycode.ENTER)
kbd.release_all()
time.sleep(0.25)
@bradmartin333
bradmartin333 / NoSleeping.ps1
Created August 8, 2022 19:57
Needlessly complicated way to keep screen awake
$count = [Enum]::GetValues([System.ConsoleColor]).Count
$WShell = New-Object -Com "Wscript.Shell"
$idx = 1
while (1)
{
$WShell.SendKeys("a")
Write-Host ([string]::Format(“No sleeping! {0}”,$idx)) -f ([System.ConsoleColor](Get-Random -Minimum 1 -Maximum $count)).value__
$idx++
sleep 60
}
#include <AccelStepper.h>
#define dirPin 2
#define stepPin 3
#define motorInterfaceType 1
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);
#define trigPin 4
#define echoPin 5
long duration; // variable for the duration of sound wave travel
int distance; // variable for the distance measurement
using System;
using System.Drawing;
namespace ImageGenerator
{
internal class Program
{
static Random RND = new Random();
static void Main(string[] args)
@bradmartin333
bradmartin333 / picPosScatter.cs
Created May 20, 2022 17:32
X_Y.png filenames to scatter
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace picPosScatter
{
internal class Program
{
static void Main(string[] args)
{
@bradmartin333
bradmartin333 / picRenamer.cs
Created May 4, 2022 12:21
Not regex, but a partwise approach to renaming problematic picture filepaths
internal class Program
{
private static readonly string dirPath = @"C:\Users\delta\Desktop\560_25p";
static void Main(string[] args)
{
string[] paths = GetSortedPicturesFrom(dirPath).ToArray();
foreach (string path in paths)
{
@bradmartin333
bradmartin333 / ImgString.cs
Created March 28, 2022 20:10
Encode an image as a single line string
static double _Scale = 0.03;
static void Main(string[] args)
{
byte[] r1 = Zip(EncodeBitmap(new Bitmap(@"C:\Users\brad.martin\Desktop\highMag.jpg")));
Bitmap bmp = DecodeBitmap(Unzip(r1));
bmp.Save(@"C:\Users\brad.martin\Desktop\test.png");
Console.WriteLine(Convert.ToBase64String(r1));
Console.ReadKey();
}
@bradmartin333
bradmartin333 / PrintLogParser.cs
Created March 7, 2022 12:14
Parse uTP.txt files by recipe and date
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace PrintLogParser
{
public partial class FormMain : Form
{
@bradmartin333
bradmartin333 / XMLdiff.py
Created February 28, 2022 14:17
Find missing/added elements in 2 XML files
import os
import xml.etree.ElementTree as ET
import difflib
dataA = []
dataB = []
f = []
for subdir, dirs, files in os.walk(os.getcwd()):
for file in files:
@bradmartin333
bradmartin333 / FolderCleaner.cs
Created February 21, 2022 14:50
Easy way to clean out frequently used archive folders
using System;
using System.IO;
using System.Linq;
namespace FolderCleaner
{
class Program
{
static void Main(string[] args)
{