Skip to content

Instantly share code, notes, and snippets.

@G33kDude
G33kDude / HtmlBox.ahk
Last active January 7, 2020 22:32
A message box style dialogue that is powered by html.
HtmlBox(HTML, Title="HtmlBox", Body=True, Full=False, URL=False, width=300, height=200)
{ ; Creates a MsgBox style GUI that has embedded HTML
global MsgBoxOK, MsgBoxActiveX, MsgBoxFull=Full
; Set up the GUI
Gui, +HwndDefault
Gui, MsgBox:New, +HwndMsgBox +Resize +MinSize +LabelMsgBox
if Full
Gui, Margin, 0, 0
else

Reverse Proxy Calibre-Web Container with Different Base URL

When using Calibre-Web from Docker, the most popular container doesn't offer an obvious way to set up a reverse proxy under a different base URL. It's simple to do by writing a request header in your reverse proxy config, as demonstrated below.

Apache

@G33kDude
G33kDude / GDI.ahk
Last active August 11, 2019 06:48
GDI wrapper for AutoHotkey
class GDI
{
__New(hWnd, CliWidth=0, CliHeight=0)
{
if !(CliWidth && CliHeight)
{
VarSetCapacity(Rect, 16, 0)
DllCall("GetClientRect", "Ptr", hWnd, "Ptr", &Rect)
CliWidth := NumGet(Rect, 8, "Int")
CliHeight := NumGet(Rect, 12, "Int")
#!/bin/bash
old="0"
while true; do
if [[ -e /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode ]]; then
new=`cat /sys/devices/platform/thinkpad_acpi/hotkey_tablet_mode`
if [[ $new != $old ]]; then
if [[ $new == "1" ]]; then
echo "Rotate to landscape"
xsetwacom set "Wacom Serial Penabled Pen stylus" rotate half
@G33kDude
G33kDude / bb-grades-export.js
Created May 3, 2019 21:42
Exports grades from your student blackboard grade center
(function(){
let doc = document;
if (doc.querySelector('iframe#mybbCanvas')) {
doc = doc.querySelector('iframe#mybbCanvas')
.contentDocument.querySelector('iframe#right_stream_mygrades')
.contentDocument;
}
let download = function(title, text) {
@G33kDude
G33kDude / PngToBase64.ahk
Last active June 18, 2018 21:06
PngToBase64
FileSelectFile, File,,, Pick a PNG, Images (*.png)
Clipboard := PngToBase64(File)
MsgBox, % "The image is now on your clipboard. Paste into your browser URL bar."
return
PngToBase64(file)
{
FileGetSize, size, % file
FileRead, bin, % "*c " file
return "data:image/png;base64," Base64enc(bin, size)
@G33kDude
G33kDude / vm.py
Last active April 15, 2018 22:30
import os
import struct
import sys
INTRANGE = 2 ** 15
REGCOUNT = 8
class Arch:
def __init__(self):
self.registers = [0] * REGCOUNT
@G33kDude
G33kDude / BlackboardDismissAll.user.js
Last active December 17, 2017 15:38
Userscript to add a "Dismiss All" button to the Blackboard Learn updates page
// ==UserScript==
// @name Blackboard Dismiss All Updates
// @namespace https://github.com/G33kDude
// @version 0.1
// @description Adds a "Dismiss All" button to the Blackboard Learn updates page
// @author GeekDude
// @match *://*.blackboard.com/webapps/streamViewer/streamViewer*
// @grant none
// @update https://gist.github.com/G33kDude/4ef48d78fde6cb07490a1c1de3ba79d0/raw/BlackboardDismissAll.user.js
// ==/UserScript==
@G33kDude
G33kDude / HideQuickLogout.user.js
Last active August 9, 2017 14:25
Hides the quick logout button for the AutoHotkey forums
// ==UserScript==
// @name Hide quick logout
// @namespace https://github.com/G33kDude
// @version 0.1
// @description Hides the quick access logout button in the toolbar next to the notifications
// @author GeekDude
// @match *://autohotkey.com/boards/*
// @grant none
// @updateURL https://gist.github.com/G33kDude/9f9ec5281a8d574847ca28540425343b/raw/HideQuickLogout.user.js
// ==/UserScript==
@G33kDude
G33kDude / Gist.ahk
Last active July 29, 2017 03:21
Gist.ahk
Gist(Code, NewUser="", NewPass="", Title="AutoHotkey", Public="1")
{
static Basic, User, Pass
if (User != NewUser || Pass != NewPass) ; If new credentials
{
User := NewUser
Pass := NewPass
if (User && Pass) ; If not blank
Basic := Base64(User ":" Pass) ; Create new basic auth code