Skip to content

Instantly share code, notes, and snippets.

@ideabucket
ideabucket / notes.md
Created November 3, 2022 06:39
X11 forwarding with Docker on macOS

It took me several hours of painful reading around to understand what works and what doesn't where the combo of macOS + Docker + X11 forwarding is concerned. So I am writing this down for my own future reference.

tl;dr: Follow the instructions in [this gist][1].

open -a XQuartz && \
  xhost +localhost && \
  docker run --rm -it --platform=linux/amd64 -e DISPLAY=host.docker.internal:0 gns3/xeyes && \
  xhost -localhost
@ideabucket
ideabucket / brew.fish
Last active November 10, 2022 20:34
Fish wrapper for brew to deactivate conda before brew {doctor,install,upgrade} and then restore environment
# converted and adapted from https://stackoverflow.com/a/62179041
function brew
set -f hooked_commands "doctor" "install" "upgrade"
if contains -- $argv[1] $hooked_commands
set -f restore_conda
set -f conda_envs
while test $CONDA_SHLVL -gt 0
set -a conda_envs $CONDA_DEFAULT_ENV
conda deactivate
@ideabucket
ideabucket / Fish.plist
Created May 3, 2022 22:16
A BBEdit codeless language module for the fish shell
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Identification -->
<key>BBEditDocumentType</key> <string>CodelessLanguageModule</string>
<key>BBLMLanguageDisplayName</key> <string>Fish Script</string>
@ideabucket
ideabucket / bbman.fish
Created April 29, 2022 04:10
Small fish script you can set as $MANPAGER to view manpages in bbedit
#!/usr/bin/env fish
# derived from Dr Drang's bman: https://leancrew.com/all-this/2022/03/last-man-standing/
# set this as your $MANPAGER to have manpages automatically open in bbedit
# col -bx to strip the formatting, read -z to make it all one string rather than an array
col -bx | read -z manbuffer
# lets us set a man-esque window title, e.g. "awk(1)"
set manname (string lower (string match -r '^[^)]+\)' $manbuffer))
(* trivial applescript to open all tabs in a Safari window in Chrome
storing it here because I _always_ forget how to get _tabs in a usable form *)
tell application "Safari"
tell application "Google Chrome" to set w to (make new window)
set _tabs to (URL of every tab of window 1)
repeat with t in _tabs
tell application "Google Chrome" to tell w to make new tab with properties {URL:t}
end repeat
end tell
@ideabucket
ideabucket / README.md
Last active December 30, 2022 15:53
BBEdit text filter to replace Markup → Tidy → Reflow XML

As of BBEdit 13.1, the HTML Tidy built-ins are back and you should use those instead. This gist is so old it refers to "OS X", c’mon!

If for some reason you are using this, note @ryanfrancesconi’s comment about the correct place to put the file when using sandboxed versions of BBEdit.

@ideabucket
ideabucket / instructions.md
Last active August 29, 2015 14:02 — forked from tealtan/instructions.md
Desuck twitter.com

Custom Twitter Stylesheet

Modified from @tealtan's original for a lighter touch. Doesn't interfere with font faces or hide UI elements, except promoted tweets and trends.

Does equalise all the tweets on your profile page to the same font size and weight.

You can add this CSS in Safari with this extension. The URL to target is twitter.com/*.

Updated 2014-09-27 to undo Twitter's hiding of pic.twitter.com links.

@ideabucket
ideabucket / Go here in iTerm2.scpt
Last active October 27, 2018 15:38
"Go Here in iTerm2" handler for BBEdit
-- based on http://pastebin.com/MSPZWWAj
-- which was in turn based on https://gist.github.com/2006738
-- but will open a new tab in the current terminal if one is open, rather than always creating a new terminal
tell application "BBEdit" to set theFile to file of document 1
tell application "Finder" to set theFolder to (container of file theFile) as alias
set theUnixPath to POSIX path of theFolder
tell application "iTerm"
if exists current terminal then
# how to migrate your Pocket reading list to Instapaper on the command line, by request from @rmi
# how to avoid getting blocked for exceeding the Instapaper API rate limit is left as an exercise for the reader
#
# yes, of course this is completely ridiculous
$ curl "https://readitlaterlist.com/v2/get?username=name&password=123&apikey=yourapikey" | \
jq '.list[].url' | \
tr -d \" | \
xargs -I %% curl "https://www.instapaper.com/api/add" -G --data "username=name" --data "pass=1234" --data-urlencode "url=%%"
@ideabucket
ideabucket / gist:1999721
Created March 8, 2012 08:45
A Short Gist About Mike Forbes!

The following bio is not endorsed by Mike Forbes!, because, amongst his many wonderful qualities, he is modest. Therefore his friends wish to toot his horn on his behalf.

Mike Forbes! is a rock of calmness and Getting Shit Done. Servers obey him; recalcitrant software bows before him. He knows everything that is worth knowing about good beer. He embraces drama and crises and smooths them into awesomeness by the power of his personality. He is kind, and patient, and friendly. He brings the magic. He is, in our considered opinion, a super awesome dude.