Skip to content

Instantly share code, notes, and snippets.

View Lokno's full-sized avatar

Lokno Ketchup Lokno

View GitHub Profile
@Lokno
Lokno / anaglyph.go
Created September 27, 2024 21:39
Takes a stereo image (side-by-side) or two images for each eye and composes them into an anaglyph image
// Author : Lokno Ketchup
// Description : Takes a stereo image (side-by-side) or
// two images for each eye and composes them into an anaglyph image
// usage: anaglyph.go [-s,--single <side-by-side>|<left> <right>] <anaglyph.png> [RGB]
//
// parameters:
// -s,--single <side-by-side> - One image file with side-by-side images one for each eye
// <left> <right> - Two image files, one for each eye.
// <anaglyph.png> - path to write the composite PNG image.
// [RGB] - (Optional) How images are distributed between the eyes.
@Lokno
Lokno / color_blindness.go
Created September 27, 2024 21:38
Transforms an PNG image to simulate various color deficiencies.
// Author : Lokno Ketchup
// Description : Transforms an PNG image to simulate various color deficiencies.
// Valid Types : normal, protanopia, protanomaly, deuteranopia, deuteranomaly,
// tritanopia, tritanomaly, achromatopsia, achromatomaly
// Usage : color_blindness.go <input> <output> <type>
//
// RGB transform matrices generated by Michael of www.colorjack.com
// Which were created using code by Matthew Wickline and the
// Human-Computer Interaction Resource Network ( http://hcirn.com/ )
@Lokno
Lokno / card_id.py
Created September 27, 2024 21:36
Python to detect the rank and value of a playing card
# Author: Lokno Ketchup
# Description : Script to detect the rank and value of a playing card
# using OpenCV 2.4.12 template matching. User must provide
# a local directory "templates" with cropped PNG files
# of each rank and suit, labeled using the keys in
# dictionaries 'ranks' and 'suits' below. For example,
# the image for the ace rank template will be A.png
#
# Rotation, distance, and perspective are not accounted for,
# so the templates must match roughly what the camera will
@Lokno
Lokno / rails.py
Created September 27, 2024 21:31
Encodes/decodes a message using the Rail Fence Cipher
# Author : Lokno Ketchup
# Description : Encodes/decodes a message using the Rail Fence Cipher
# Allows for recursively encoding of a message multiple times.
# usage: rails.py [-h] [-d] [-b BLOCKS] input output count [count ...]
# Parameters :
# [-d,--decode] - decodes if present (defaults to encoding)
# [-b BLOCKS, --blocks BLOCKS] - expects encoded message in groupings of the specified size
# <input> - file to encode/decode
# <output> - file to write output.
# count [count ...] - list of rail counts to encode
@Lokno
Lokno / value_reduction.shader
Last active December 5, 2023 17:00
OBS shaderfilter designed to clamp the value of a color the more desaturated it is
// https://obsproject.com/forum/resources/obs-shaderfilter.1736/
uniform float vmaxThreshold<
string label = "Threshold";
string widget_type = "slider";
float minimum = 0.0;
float maximum = 1.0;
float step = 0.001;
> = 0.2; //<Range(0.0, 1.0)>
@Lokno
Lokno / blink_wifi_tk_app.py
Created November 28, 2023 19:11
Combines the Telemetrix-AIO library with tk interface to blink an LED on pin 2 of a microcontroller at a specified ip address
@Lokno
Lokno / websocket_pyfirmata_servo.py
Last active November 22, 2023 00:54
Websocket Server that Interfaces with PyFirmata intended to be used with Pixel Composer
import asyncio
import websockets
import pyfirmata
import json
import platform
major,minor,_ = platform.python_version_tuple()
if major != '3':
logging.error('ERROR: Python 3 required to run.')
sys.exit(-1)
@Lokno
Lokno / find_java_versions.bat
Last active July 23, 2023 20:14
Searches for all java.exe executables on the host machine and runs each with the -version flag to display the Java version information.
@echo off
REM Batch Script: find_java_versions.bat
REM Description: Searches for all java.exe executables on the host machine and runs each with the -version flag
REM to display the Java version information.
REM Set the initial search directory to the root of the C drive (you can change this if needed)
set "search_dir=C:\"
echo Searching for any Java executables ^(java.exe^) in the %search_dir% directory...
@Lokno
Lokno / eval_clipboard.py
Created January 23, 2023 21:02
Executes the contents of the clipboard as Python and returns the result to the clipboard
# Executes the contents of the clipboard as Python and returns the result to the clipboard
# Uses eval() if single-line and uses compile() and exec() if multi-line
# Will attempt to handle a limited number of NameError exceptions
# Obvious at your own risk and know what you're doing caveats
import pyperclip
import traceback
import contextlib
import sys
import re
@Lokno
Lokno / ocr_shortcut.ahk
Last active January 13, 2023 20:04
AutoHotKey script to add a keyboard shortcut to process a region of the screen using OCR and copy the result into the clipboard
; AutoHotKey script to add a keyboard shortcut to select a region of the screen,
; run OCR on that region, and paste the result in the clipboard.
; Set to look for English text, see line 24
; Shortcut default is ctrl+shift+alt+i, see line 20
; Press esc when selecting to close, or right-click system tray icon
; Modified script from OP of this forum post:
; https://www.autohotkey.com/boards/viewtopic.php?p=314654#p314654