Skip to content

Instantly share code, notes, and snippets.

View Lokno's full-sized avatar

Jonathan Decker Lokno

View GitHub Profile
@Lokno
Lokno / toggleHueSatLayers.js
Last active December 30, 2015 23:45
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 / scrub.ahk
Created June 17, 2016 21:18
Remaps keys in photoshop for scrubbing
#IfWinActive, ahk_class Photoshop
{
; sends Page Up instead of comma ( Back one frame )
,::
SendInput {PgUp}
return
; sends Page Down instead of period ( Forward one frame )
.::
@Lokno
Lokno / javai.py
Last active July 19, 2016 21:23
A basic Java interpretor
# Provides a basic command line interpretor for Java
#
# Recognizes import statements and places them accordingly
# All other statements are placed in the body of a main method
# To execute and print a result type "print <statement>"
# Type q/e/quit/exit/close to exit interpretor
import subprocess,re
def writeJava( filename, classname, imports, state, cmdstr ):
@Lokno
Lokno / stitch.py
Last active July 20, 2016 21:21
Script to update a ratio via commands posted in a twitch channel
# Script to update a ratio via commands posted in a twitch channel
# See: http://help.twitch.tv/customer/portal/articles/1302780-twitch-irc
import socket
import re,os
server = "irc.chat.twitch.tv"
channel = "#CHANNEL"
botnick = "NICKNAME"
password = "OAUTHPASS"
@Lokno
Lokno / ctrlclick.ahk
Created January 19, 2017 19:40
Uses autohotkey to simulate Mac OS Style ctrl + click for right click functionality in Windows (https://autohotkey.com/)
^LButton::
Send {RButton}
@Lokno
Lokno / notweet.ahk
Created January 19, 2017 21:51
Polls every second and if it finds a window title starting with "Twitter" it closes it
Loop {
IfWinActive, Twitter
{
SendInput ^w
}
Sleep, 1000
}
@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
{
@Lokno
Lokno / post_as_bot.py
Created September 7, 2017 16:55
Command-line utility for posting a message as a slack bot
import os,sys
from slackclient import SlackClient
if len(sys.argv) < 2:
print "usage: post_as_bot.py <message>"
sys.exit(-1)
msg = ' '.join(sys.argv[1:])
BOT_NAME = 'BOTNAME'
@Lokno
Lokno / hours.py
Last active October 12, 2017 21:16
Utility to divide up a workweek among multiple projects
# Author : Jon Decker
# Description : Utility to divide up a workweek among multiple projects
import sys
days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
if len(sys.argv) < 3:
print(" usage: hours.py <number of days> <list of percentages> [hours in day]")
else:
@Lokno
Lokno / hanoi-domain.pddl
Created November 2, 2017 21:48
Tower of Hanoi Domain for the Metric-FF Planner
(define (domain hanoi-domain)
(:types disk peg - object)
(:predicates (smaller ?x - disk ?y - object )
(on ?x - disk ?y - object)
(clear ?x - object ))
(:functions (cost))
(:action Move
:parameters (?d - disk ?c - object ?n - object)
:precondition (and
(smaller ?d ?n)