Skip to content

Instantly share code, notes, and snippets.

Michael B heptal

  • Baton Rouge, LA
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

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.

heptal /
Last active Dec 29, 2019
Hammerspoon replacement for Caffeine


Simple toggleable menubar replacement for Caffeine in Hammerspoon, utilizing ASCIImage (for vector) to create the amphetamine icons. Motivated by the official Caffeine app's icon looking bad on Retina

Get latest version here: amphetamine.lua

Save as amphetamine.lua in ~/.hammerspoon/ and put amphetamine = require "amphetamine" in your init.lua

heptal / bing-full-image-preview-replace.user.js
Last active Aug 12, 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
// @updateURL
// @match https://**
// @grant none

Displaying images in the terminal with tput and echo


Requires ImageMagick, easily available from your favorite package manager. Tested on Linux and OSX
convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n "  ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash
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 / 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
heptal /
Last active Jul 18, 2016
Removable volume manager in Hammerspoon

A simple menubar utility for opening/ejecting/managing removable volumes that looks good in OSX Dark mode:

Conveniently hides itself when no volumes are mounted and reappears when one is mounted:

Get it here - volumes.lua

Save as volumes.lua in ~/.hammerspoon/ and put volumes = require "volumes" in your init.lua

View SAThreadSearch.user.js
// ==UserScript==
// @name SAThreadSearch
// @namespace
// @version 0.2
// @description Inline thread search
// @author Me
// @match*
// @match*
// @grant none
// ==/UserScript==
heptal / SASmilieSearch.user.js
Last active May 2, 2016
Smilie autocomplete search box
View SASmilieSearch.user.js
// ==UserScript==
// @name SASmilieSearch
// @namespace
// @version 0.1.5
// @description Smilie autocomplete search box
// @author Me
// @match
// @match
// @grant none
// ==/UserScript==
You can’t perform that action at this time.