Skip to content

Instantly share code, notes, and snippets.

Drugoy /
Created September 4, 2023 21:04 — forked from senderle/
So you want to modify the text of a PDF by hand

So you want to modify the text of a PDF by hand...

If you, like me, resent every dollar spent on commercial PDF tools, you might want to know how to change the text content of a PDF without having to pay for Adobe Acrobat or another PDF tool. I didn't see an obvious open-source tool that lets you dig into PDF internals, but I did discover a few useful facts about how PDFs are structured that I think may prove useful to others (or myself) in the future. They are recorded here. They are surely not universally applicable --
the PDF standard is truly Byzantine -- but they worked for my case.

Drugoy /
Created August 26, 2020 22:03 — forked from fntlnz/
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
Drugoy / tmux.conf
Created January 18, 2017 21:56
Someone's tmux.conf
# tmux configuration file
# set terminal to "screen-256color"
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
bind r source-file ~/.tmux.conf
// ==UserScript==
// @name Reddit Display Inline Images
// @namespace
// @description Displays linked imgaes directly in the page
// @version 2.0
// @updateURL
// @include*
// @include*
// @author aditya
// @grant GM_xmlhttpRequest
Drugoy / netStandDescription
Last active August 29, 2015 14:12
A small script to save describe networking stands
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SetWorkingDir, %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance, Force
If %0% ; The script was called with at least 1 argument, expectedly the user drag'n'dropped something onto the script.
Loop, %0%
input := %A_Index%
If FileExist(input) ; Not sure if this needed, since user can't drag'n'drop an unexisting file.
FileRead, input, %input%
Drugoy / QuotesRe 4 ahk.coder
Last active January 1, 2016 22:09
Сгруппированные правила для QuotesRe секции ahk.coder
; Quotation marks
0 `(")((?:[^"]*?(?:"")?)*?)("(?!"))` `\1=(2,#ff0000,0) \2=(3,#00ff00,0) \3=(3,#ff0000,0)`
; 0args
0 `^(.*::)?\s*(#ErrorStdOut|#InstallKeybdHook|#InstallMouseHook|#NoEnv|#NoTrayIcon|#Persistent|#WinActivateForce|Edit|EnvUpdate|KeyHistory|ListHotkeys|ListVars|Reload|SplashTextOff|WinMinimizeAll|WinMinimizeAllUndo)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`
; 1u
0 `^(.*::)?\s*(#If|#InputLevel|#SingleInstance|#UseHook|Break|Catch|Continue|Critical|Exit|ExitApp|FileEncoding|FileRecycleEmpty|ListLines|OnExit|Return|SetCapsLockState|SetNumLockState|SetScrollLockState|Suspend|Throw)(\s*,\s*|\s+([^;]*?))?(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \4=(2,${VAR},#ff0000) \5=(3,${COMM},0)`
; 2u
0 `^(.*::)?\s*(#IfWinActive|#IfWinNotActive|#IfWinExist|#IfWinNotExist|#Warn|ClipWait|Pause|SoundBeep)(\s*,\s*|\s+([^;]*?))?(\s+;.*$)?(\s*,\s*([^;]*?))?(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \4=(2,${VAR},#ff0000) \5=(3,${COMM},0) \7=(2,${VAR},#00ff00) \8=(3,${COMM},0)`
; 3u
0 `^(.*::)?\s
Drugoy / ahk.coder QuotesRE
Created December 31, 2013 00:58
Правила для секции QuotesRE для ahk.coder. Эти правила должны раскрасить аргументы у практически всех команд.
0 `(")((?:[^"]*?(?:"")?)*?)("(?!"))` `\1=(2,#ff0000,0) \2=(3,#00ff00,0) \3=(3,#ff0000,0)`
; 0args
0 `^(.*::)?\s*(#ErrorStdOut)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`
0 `^(.*::)?\s*(#InstallKeybdHook)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`
0 `^(.*::)?\s*(#InstallMouseHook)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`
0 `^(.*::)?\s*(#NoEnv)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`
0 `^(.*::)?\s*(#NoTrayIcon)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`
0 `^(.*::)?\s*(#Persistent)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`
0 `^(.*::)?\s*(#WinActivateForcet)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`
0 `^(.*::)?\s*(Edit)(\s+;.*$)?$` `\1=(2,${STR},0) \2=(2,${OP},0) \3=(3,${COMM},0)`