Skip to content

Instantly share code, notes, and snippets.

View Lokno's full-sized avatar

Jonathan Decker Lokno

View GitHub Profile
@Lokno
Lokno / color_blindness.go
Created September 17, 2014 14:32
Transforms an PNG image to simulate various color deficiencies.
// Author : Jonathan Decker
// 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 / anaglyph.go
Last active August 29, 2015 14:07
A Go-lang script that composes an anaglyph image from two images
// Author : Jonathan Decker
// 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 / trimbarcode.ahk
Last active August 29, 2015 14:21
Autohotkey Script for trimming bar codes
; Pause : ctrl+a, ctrl+c , delete prefix, ctrl+v
; Home : delete the prefix
; Esc : close the running script
prefixLength := 8
codeLength := 30
remainder := codeLength-prefixLength
TrimBarCode()
{
@Lokno
Lokno / filterbarcode.ahk
Last active August 29, 2015 14:21
Autohotkey script that captures all digits keys and pastes the last 22-digits of every 30-digit number typed
; Captures all digits keys and pastes the last 22-digits of every 30-digit number typed
; Replaces clipboard with result
; Press the 'pause' key to suspend the script. Press it again to resume.
; Press home to reset state
numstr =
count := 0
prefixLength := 8
codeLength := 30
@Lokno
Lokno / numChanger.ahk
Last active August 29, 2015 14:21
AutoHotkey Script that lets you increment/decrement a selected number in a body of text
; Adds shortcuts to increment/decrement a selected number in a body of text
; Use Shift + Mouse Wheel
AddSelection( sign )
{
Send ^c
if( RegExMatch( clipboard, "^-?[0-9.]+$" ) ) ; is number
{
; determine smallest increment
dotPos := InStr( clipboard, "." )
@Lokno
Lokno / uniformcp.ahk
Last active August 29, 2015 14:22
Extends ctrl+c and ctrl+v copy/paste shortcuts to terminals
; Enables ctrl+c and ctrl+v for command line terminals
; Escape is used in the place of the ctrl+c interrupt
$^c::
if WinActive("ahk_class ConsoleWindowClass") or WinActive("ahk_class PuTTY")
{
SendInput {Enter}
}
else
{
@Lokno
Lokno / delete.ahk
Created June 22, 2015 03:55
AutoHotkey script that deactivates a direct delete key press
; Deactivates a direct delete key press
; Shift + Delete required to send delete
^Del::Send Del
Del::return
@Lokno
Lokno / recolor.js
Last active October 26, 2015 19:40
Changes the hue of every layer of the active document
// enable double clicking
#target photoshop
// make Photoshop the frontmost application
app.bringToFront();
// all the strings that need localized
var strHistoryStepName = localize("$$$/JavaScripts/Recolor/Menu=Recolor" );
var doc = app.activeDocument;
@Lokno
Lokno / toggleLayerType.js
Last active November 5, 2015 20:12
Toggle visiblity of a certain kind of layer in photoshop
// Install by saving to PHOTOSHOP_DIRECTORY/Presets/Scripts
// Also works just by opening it with File->Open..
// Once installed, you can add an action to run it with a keyboard shortcut
// Open Actions window (Window->Actions)
// Click the "Create a New Action" Button (dog-eared paper icon)
// Choose the name of the action and the shortcut keys you want
// Click Record
// Select Insert Menu Item...
// Select File->Scripts->toggleLayerType
@Lokno
Lokno / rails.py
Last active December 1, 2015 19:52
# Author : Jonathan Decker
# 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