Skip to content

Instantly share code, notes, and snippets.

View Lokno's full-sized avatar

Lokno Ketchup Lokno

View GitHub Profile
@Lokno
Lokno / colorMatrices.js
Last active July 30, 2023 01:02
Color Blindness Matrices
// JSON of 3x3 matrices which transform RGB colors into colorspace which
// simulate the imparement of various color blindness deficiency.
//
// Used by Coblis: http://www.color-blindness.com/Coblis-color-blindness-simulator/
//
// The original website posting the matrices has been taken down:
// http://www.colorjack.com/labs/colormatrix/
//
// RGB transform matrices generated by Michael of www.colorjack.com
// Which were created using code by Matthew Wickline and the
@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 January 3, 2025 20:59
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 / toggleHueSatLayers.js
Last active January 3, 2025 20:59
Toggle the hue and saturation adjustment layers in photoshop
#target photoshop
var currentDoc = app.activeDocument;
for ( var i = 0; i < currentDoc.layers.length; i++ ) {
var layer = currentDoc.layers[i];
if( layer.kind === LayerKind.HUESATURATION )
{
layer.visible = layer.visible ? false : true;
}
@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 / add_alpha.c
Last active February 21, 2017 22:56
C Code using STB library image reader/writer to create a new PNG with an imperceptible amount of transparency in the upper-left pixel. https://github.com/nothings/stb
#define STBI_ONLY_PNG
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#include <stdio.h>
typedef union
{