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
Seems to run stable for hours!
If you can't see your cursor after killing it, run
tput cnorm
Sometimes you may see a seq error if you run it multiple times with different resolutions in the same session. Easier to make a new session, or you can change it unset the variables used initially.
For beginners and experts alike, IPython Notebook, along with the package collection Anaconda, has to be the premier interactive Python environment for playing, learning, prototyping, and exploring data. IPython Notebook is a browser-based environment where you can combine code execution, text, mathematics, plots and rich media into a single document. Look at these awesome examples (
// Convenience extension for reading from NSInputStream from swift | |
// Useful for reading binary data in chunks using arbitary structs | |
extension NSInputStream { | |
func readByteArray(len: Int) -> [UInt8] { | |
var readBuffer = Array<UInt8>(count:len, repeatedValue: 0) | |
let numberOfBytesRead = self.read(&readBuffer, maxLength: readBuffer.count) | |
assert(numberOfBytesRead == len) | |
return readBuffer | |
} |
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
Hackjob of autocomplete in the Hammerspoon console
Binds tab to autocomplete when console window has focus using hs.window.filter
This is all user lua except for the added hs.console.getInput
which returns text and cursor position
Autocompletes on everything in _G, help.hs.whatever, hs.thing.otherthing, etc. Autocompletes userdata object methods via getmetatable
local function complete(consoleInput)
local text, position = consoleInput['text'], consoleInput['cursorPosition']
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
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