Skip to content

Instantly share code, notes, and snippets.

Michael B heptal

  • Austin, TX
Block or report user

Report or block heptal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@heptal
heptal / bing-full-image-preview-replace.user.js
Last active May 21, 2019
Bing Image Search Thumb Full-Rezifier
View bing-full-image-preview-replace.user.js
// ==UserScript==
// @name Bing Image Thumb Lazarusizer
// @namespace BingThumbnailLazarus
// @version 0.1
// @description Full-rez the image src attribute for preview images in BIS results - just right-click and open/save
// @author heptal
// @downloadURL https://gist.github.com/heptal/8c8c90cb67bfe17e23a38c721ae64331/raw/eee850139b1d9c9d6cc1fafb1506ea6cdaa34193/bing-full-image-preview-replace.user.js
// @updateURL https://gist.github.com/heptal/8c8c90cb67bfe17e23a38c721ae64331/raw/eee850139b1d9c9d6cc1fafb1506ea6cdaa34193/bing-full-image-preview-replace.user.js
// @match https://*.bing.com/images/search*
// @grant none
View hax.js
(async () => { while (document.querySelectorAll(`[conversation="conversation"]`).length) {
for (let sel of [`gv-thread-item>div`, `[aria-label="More options"]`, `[aria-label="Delete"]`, `[aria-label="Delete"]`]) {
await (new Promise((resolve) => setTimeout(resolve, 300))); document.querySelector(sel).click() }}})()
@heptal
heptal / discord-filter-delete.js
Last active Mar 14, 2019
Pattern (regex) based mass deletion of discord messages, with UI button!
View discord-filter-delete.js
// enable developer tools (aka chrome inspector) in discord app
// in dev tools get user token from Application > Local Storage (or google how)
// then go to Sources, open Snippets, add and save this code (replacing token with your own)
// use play button in the bottom right to enable, creating a new 'Purge' widget
// discord search in a server/dm (example - from: you, before: jan 2019) and get a postid
// paste in the appropriate input box to delete older/newer messages
const token = "sUp3R-s3kR1t"; //replace with your own
View mpd.md

I recently discovered mpd and found it to be a nice little program. There is a dearth of nice-looking OSX clients, though (besides terminal clients).

Using the hs.socket extension (in master, but not yet in the latest official release), I've created a Hammerspoon frontend that speaks the mpd protocol. With what I have so far, it's already much faster and easier to use than iTunes. I'll link the code on the Hammerspoon wiki once everything is finalized, but an in-progress version is available here.

Using hs.menubar, I've created a series of menubar items to assist with controlling playback. Hovering over the play/pause icon shows the current track.

View SAThreadSearch.user.js
// ==UserScript==
// @name SAThreadSearch
// @namespace forums.somethingawful.com
// @version 0.2
// @description Inline thread search
// @author Me
// @match http://forums.somethingawful.com/showthread.php*
// @match https://forums.somethingawful.com/showthread.php*
// @grant none
// ==/UserScript==
@heptal
heptal / SASmilieSearch.user.js
Last active May 2, 2016
Smilie autocomplete search box
View SASmilieSearch.user.js
// ==UserScript==
// @name SASmilieSearch
// @namespace forums.somethingawful.com
// @version 0.1.5
// @description Smilie autocomplete search box
// @author Me
// @match http://forums.somethingawful.com/misc.php?action=showsmilies
// @match https://forums.somethingawful.com/misc.php?action=showsmilies
// @grant none
// ==/UserScript==
@heptal
heptal / patterns.md
Last active Apr 20, 2016
Lua pattern matcher UI in Hammerspoon webview
View patterns.md

local name = "id"..hs.host.uuid():gsub("-","");

local html = [[
<div><pre>
.   all characters
%a  letters
%b  balanced delimiters
%c  control characters
@heptal
heptal / webview_usercontent.md
Last active Apr 18, 2016
Poor man's imitation of Postman in Hammerspoon
View webview_usercontent.md

Exploring the possibilities with hs.webview and hs.webview.usercontent. The primary feature here is WKUserContentController, which allows for injecting user scripts into a web view and for JavaScript to post messages directly back to the native runtime.

The good thing is it's very easy to design the web portion in JS sketchbooks such as jsbin/codepen/jsfiddle because the snippet code structure maps cleanly to this. The bad part is that WKWebView doesn't always behave consistently or have a clean slate. Maybe this will help resolve state issues in the future. It will randomly not be able to find injected scripts without any code changes, and I haven't figured out why.

In this, a two-column table in HTML can be filled with values from Lua tables, and can also send them back. This is used for HTTP requests with arbitrary headers in a fun and exciting way.

@heptal
heptal / docker.md
Last active Mar 9, 2016
Docker manager in Hammerspoon
View docker.md

Docker management menubar utility

Got tired of having to constantly manipulate the docker CLI commands for basic operations and for which the API has changed rapidly in the past year (much top-ranked info out there is out of date)

Assuming docker is installed (brew cask install dockertoolbox):

  • Start/stop/remove docker containers
  • Easily copy container IP to pasteboard addresses by just clicking
  • Conveniently open browser on container's exposed port
  • Open Kitematic GUI app included with dockertoolbox by clicking Docker
You can’t perform that action at this time.