Skip to content

Instantly share code, notes, and snippets.

@DaneWeber
DaneWeber / NPP-Py-AnalyzeExcelFormula
Last active August 29, 2015 13:57
Notepad++ Python Script for Analyzing Nested Parentheses and Comma-Separated Arguments. Posted to https://sourceforge.net/p/notepad-plus/discussion/1290590/thread/c17ed459/
#!/usr/bin/python
# input_text = editor.getSelText()
input_text = '=HLOOKUP(TablePeriods[[#Headers],[YearMonth]],TablePeriods[[#All],[YearMonth]],MATCH([@Date],INDIRECT("TablePeriods[[#All],["&[@Account]&"]]"),-1))'
# initialize the state table
state_table = {}
# event list and corresponding state table
event_list = ( "\"", "&", "(", ")", ",", "\n\r\t ", "[", "]", "{", "}" ) # last event is anything that doesn't match one of the other actions
@DaneWeber
DaneWeber / NPP-Py-DeAnalyzeExcelFormula
Last active August 29, 2015 13:57
Notepad++ Python Script for De-Analyzing Nested Parentheses and Comma-Separated Arguments. Posted to https://sourceforge.net/p/notepad-plus/discussion/1290590/thread/c17ed459/
input_text = editor.getSelText()
EVENTS = 3
STATES = 2
state_table = [[[0,0] for x in range(EVENTS)] for x in range(STATES)]
event_list = [ "\"", "\n\r\t " ] # last event is anything that doesn't match one of the other actions
state_table[0] = [[1,0], [0,1], [0,0]] # normal state
state_table[1] = [[0,0], [1,0], [1,0]] # double-quote comment
; Copied from http://www.autohotkey.com/board/topic/10412-paste-plain-text-and-copycut/
#v:: ; Text–only paste from ClipBoard | WIN and V keys are the hotkey
KeyWait, LWin ; Wait for the Windows key to be lifted,
KeyWait, RWin ; since it would sometimes combine with the pasted text.
OldClip = %ClipBoardAll% ; Save formatted text for later
ClipBoard = %ClipBoard% ; Convert to text
Send ^v ; For best compatibility: SendPlay | simulates pressing CRTL and V keys
Sleep 50 ; Don't change clipboard while it is pasted! (Sleep > 0)
ClipBoard = %OldClip% ; Restore original ClipBoard
VarSetCapacity(OldClip, 0) ; Free memory
#b:: ; Simulate typing of the text on the clipboard
KeyWait, LWin ; Ensure that the Windows key has been lifted.
KeyWait, RWin
ToPaste = %ClipBoard% ; Convert to text
Sleep 100
StringReplace, ToPaste, ToPaste, `r`n, `n, All ; Prevent CR+LF from causing two newlines
Sleep 100
SendRaw %ToPaste% ; SendRaw simulates typing the characters exactly, including AHK's special !^#+ characters
Return
/:~ ~. 1!:1 <'C:/Path/ICD10/icd10withHierarchy.txt'
%&'()+,-./0123456789<=>ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz
@DaneWeber
DaneWeber / AHK-per-file-7zip.ahk
Last active August 29, 2015 14:27
Use 7Zip on each file within a directory, saving the resulting archives to a new directory
InputBox, password, Enter Password for Archives, The generated archives will be protected with the password you enter below. Your input will be masked., hide
; Using FileSelectFolder is just one way of choosing your folders.
FileSelectFolder, sourcepath,,, Source Folder
sourcepath := RegExReplace(sourcepath, "\\$") ; Removes the trailing backslash, if present.
FileSelectFolder, destinationpath,,, Destination Folder
destinationpath := RegExReplace(destinationpath, "\\$") ; Removes the trailing backslash, if present.
sourcelen := StrLen(sourcepath) + 1 ; Determine the start of the variable part of the path.
Loop, Files, %sourcepath%\*.*, R
{
@DaneWeber
DaneWeber / AHK-mailto-gmail.ahk
Last active September 13, 2015 00:39 — forked from anonymous/AHK-mailto-gmail.ahk
AHK script to be Windows default mailto app, forwarding to Gmail
; Copied from http://www.autohotkey.com/board/topic/39551-change-the-default-mailto-to-gmail/
; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
; SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Haystack = %1%
;~ If no paramter is given when the run of it, it registers itself as the default mailto
; commented out because I'd rather set it as default by myself.
@DaneWeber
DaneWeber / jsoftware.xml
Created September 15, 2015 20:19
Notepad++ syntax highlighting for the J programming language (jsoftware.com) - unknown original source
<NotepadPlus>
<UserLang name="J" ext="ijs" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00NB. 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@DaneWeber
DaneWeber / Magic-Button-Masher.ahk
Created September 23, 2013 17:33
This is my attempt at a program that will allow you to type randomly on the keyboard and have pre-determined text entered instead. This can be useful when performing live demonstrations or when you want to impress someone (ha!). Started as a response to a question on SuperUser: http://superuser.com/questions/642041/hacker-typer-style-application…
#UseHook ; Avoid loops of the Send command triggering the hotkey again.
AutoTrim, Off ; Don't auto-trim spaces and tabs from the beginning and end of the sourcetext.
SendMode InputThenPlay ; Try to prevent the user from corrupting the buffer text.
SetWorkingDir %A_ScriptDir%
Suspend, On ; Start suspended
FileRead, MasherBuffer, magic-button-masher-text.txt
if ErrorLevel
MasherBuffer = Type or paste text here. You can also drag-and-drop text files here.
@DaneWeber
DaneWeber / WordFindAllInstances
Created November 26, 2013 17:34
Find All Instances of the match value. You can see the results inserted into the "Immediate" debug area. Press Ctrl+G if you don't see it. See this page if you don't know how to install a macro: http://www.gmayor.com/installing_macro.htm
Option Explicit
Sub FindAllInstances()
Dim MyAR() As String
Dim i As Long
Dim match As String
match = "has"
i = 0