Skip to content

Instantly share code, notes, and snippets.

View SightSpirit's full-sized avatar

Eden Biskin SightSpirit

View GitHub Profile
@SightSpirit
SightSpirit / crank.py
Last active July 28, 2023 15:58
A Python class representing a turnable crank
'''
Description:
I got bored and decided to make a class in Python. The `Crank` class represents a turnable crank and tracks how many degrees it's been turned and how many times it has been fully turned. (I may or may not have been inspired subconsciously by *Unbreakable Kimmy Schmidt*.)
Example Use Case:
I genuinely do not know, but I am genuinely excited to find out how someone uses this!
License:
This code is in the public domain. You may use it for any purpose that is considered legal in your jurisdiction, including for-profit purposes, without providing attribution or including a similar license. You may attribute to Eden Biskin, if desired.
'''
@SightSpirit
SightSpirit / datastructs.py
Created July 27, 2023 16:54
Python implementations of some abstract data structures
'''
Description:
I've always had trouble wrapping my head around some data structures, so I decided to practice implementing the easier ones in Python. This module is the result.
Example Use Case:
So many possibilities! These serve as alternatives to the `list` structure.
License:
This code is in the public domain. You may use it for any purpose that is considered legal in your jurisdiction, including for-profit purposes, without providing attribution or including a similar license. You may attribute to Eden Biskin, if desired.
'''
@SightSpirit
SightSpirit / Import-ADMX-from-Desktop.ps1
Created June 5, 2023 13:48
Windows PowerShell script to import Group Policy templates from Desktop
#Requires -RunAsAdministrator
function Pop() { Pop-Location }
"$env:USERPROFILE\Desktop" | Push-Location
"Looking for ADMX files..."
$admx = Get-Item *.admx -ErrorAction SilentlyContinue
if ($admx.Count -lt 1) {
Write-Error "Unable to find any ADMX files on the Desktop."
} else {
@SightSpirit
SightSpirit / FortuneTeller.java
Last active March 31, 2022 15:04
Humorous, Java-based "fortune teller" applet
import javax.swing.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.util.PrimitiveIterator;
import java.util.Random;
import java.util.stream.IntStream;
/**
* @author Eden Biskin
@SightSpirit
SightSpirit / CenterOnPage.vba
Last active March 31, 2022 13:46
Some Microsoft Visio macros
'1-line macro that centers an entire drawing on the page. Moves all shapes together, so their relative positions remain intact.
Sub CenterOnPage()
Application.ActivePage.CenterDrawing
End Sub
@SightSpirit
SightSpirit / restartExp.bat
Created February 23, 2022 21:05
Simple Windows batch file that restarts Windows Explorer
@ECHO OFF
ECHO "Are you sure you want to restart explorer.exe?"
SET /P YN="Y/N> "
IF /I %YN%==Y (
TASKKILL /F /PID explorer.exe && START %SYSTEMROOT%\explorer.exe
)
@SightSpirit
SightSpirit / Swapsies.java
Created February 8, 2022 15:54
A Java class that demonstrates how to swap two objects in an array using a placeholder variable
/*
Description:
This is a frivilous example of swapping the positions of two objects (in this case, ints) in a Java array. I wrote this on September 8, 2021, (fixed on September 10) to amuse myself and give myself a doable Java problem to solve.
Example Use Case:
None? Well, you can probably find some way of adapting it for use in a much larger program. But I'm sure there are thousands of other examples of the same algorithm (and more efficient ones). Also, this program contains weird identifiers…
License:
This code is in the public domain. You may use it for any purpose that is considered legal in your jurisdiction, including for-profit purposes, without providing attribution or including a similar license. You may attribute to Eden Biskin, if desired.
*/
@SightSpirit
SightSpirit / File Away Emails by Label.gs
Last active July 27, 2023 17:07
Template for Google Apps Script for filing away emails with a certain label
/*
THIS FILE WILL NOT RUN PROPERLY UNTIL YOU ADAPT IT TO YOUR USE CASE. (i.e. label name)
Replace instances of "[...]" with relevant strings.
Description:
This script will archive and mark-read ALL Gmail conversations (threads) that have a given label. It also logs the timestamps of each range it is currently processing.
Efficiency is O(n), NOT accounting for the unknown efficiencies of built-in GAS functions. The script runs markRead(0) and moveToArchive(0) functions on consecutive batches of 100 threads. As a result, it is more efficient when working with labels containing fewer threads.
Example Use Case:
The original author of this script wrote it to file away those daily agenda emails sent by Google Calendar. I don't always read them, so this script helps clean up my inbox of them.
@SightSpirit
SightSpirit / importRegTemplate.bat
Created December 31, 2021 21:30
Template for batch file to import registry keys from a local file into another user's hive
:: THIS FILE WILL NOT RUN PROPERLY UNTIL YOU ADAPT IT TO YOUR USE CASE. (file paths, etc.)
:: Replace instances of "[...]" with relevant paths.
::
:: This template is in the public domain. Attribute to Eden Biskin if desired.
::
@ECHO Off
ECHO Step 1: Attempting to load other account's hive...
REG LOAD HKU\temp "C:\Users\[other username]\NTUSER.DAT" >nul
IF %ERRORLEVEL% EQU 1 GOTO loadfail
IF %ERRORLEVEL% NEQ 1 GOTO loadgood
@SightSpirit
SightSpirit / upd.sh
Last active June 5, 2023 13:52
Bash shell script for updating packages on Debian-based OSs using apt-get.
#!/bin/bash
PROMPT_COMMAND='echo -ne "\033]0;Package Updater\007"'
echo "~~~~~ PACKAGE UPDATER ~~~~~"
echo
sudo -p "Enter %u's password to continue: " echo Checking for updates. Please wait...
if [ $? -ne 0 ] ; then
echo Unable to verify identity. Please run upd again.