Skip to content

Instantly share code, notes, and snippets.

@bradchoate
bradchoate / mltshp-random-bookmarklet.url
Last active May 19, 2023 05:10
MLTSHP Bookmarklet for a random post
javascript:(function(){(async()=%3E{let%20e=%22https://mltshp.com/%22;0!==location%3F.href%3F.indexOf(e)%26%26(alert(%22First,%20navigating%20to%20MLTSHP...%20then,%20run%20this%20again!%22),location.href=e);let%20t=%22latestImageSharekey%22,n=localStorage,r=JSON.parse(n.getItem(t)||%22{}%22),i=Date.now(),l=i-864e5;if(r%3F.t%3Cl%26%26(r={}),r%3F.k||await%20fetch(`${e}incoming`).then(e=%3Ee.text()).then(e=%3E{let%20l=new%20DOMParser;r={k:l.parseFromString(e,%22text/html%22).querySelector(%22.inline-meta%20a%22).getAttribute(%22href%22).split(%22/%22)[2],t:i},n.setItem(t,JSON.stringify(r))}),r%3F.k){let%20a=%220123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ%22,g=e=%3E{let%20t=a.length,n=0;for(let%20r=0;r%3Ce.length;r++){let%20i=e.length-r-1,l=a.indexOf(e[r]);n+=l*Math.pow(t,i)}return%20n},h=g(r.k),o=e=%3E{let%20t=a.length,n=%22%22;for(;0!==e;){let[r,i]=[Math.floor(e/t),e%25t];e=r,n=a[i]+n}return%20n};for(;;){let%20s=Math.floor(Math.random()*h),f=o(s),$=`${e}p/${f}`;await%20fetch($).then(e=%3E{200===e.status%26%26(location
@bradchoate
bradchoate / keybase.md
Last active August 29, 2015 13:57
Keybase proof of identity

Keybase proof

I hereby claim:

  • I am bradchoate on github.
  • I am bradchoate (https://keybase.io/bradchoate) on keybase.
  • I have a public key whose fingerprint is EE15 4DE2 1359 62F0 786B B116 ED76 B4D1 3C01 4D64

To claim this, I am signing this object:

@bradchoate
bradchoate / rmdbc.bash
Created August 2, 2012 17:24 — forked from ttscoff/rmdbc.bash
Bash alias to recursively delete Dropbox conflicted files
alias rmdbc="find . -name *\ \(*conflicted* -delete" # recursively delete Dropbox conflicted files
# and/or (smart idea from Gordon Fontenot)
alias rmdbc-safe="find . -name *\ \(*conflicted* -exec mv {} ~/DropboxConflicts/ \;" # recursively move Dropbox conflicted files to temp folder
javascript:var%20body=document.getElementsByTagName("body")[0];var%20bgimage=window.getComputedStyle(body).getPropertyValue("background-image");if%20(bgimage=="none")bgimage=body.background;else%20bgimage=bgimage.replace(/(^url\(|\)$)/g,'');if(bgimage)window.open(bgimage);else%20alert("No%20background%20image%20could%20be%20located.");
@bradchoate
bradchoate / Gather Windows.scpt
Created November 18, 2009 19:31
AppleScript for pulling scattered windows back to the Desktop viewport.
-- A little script to gather any application windows that are partially
-- offscreen in some way and shift them back to the desktop. This is
-- particularly useful if you use a MacBook with an external display.
tell application "Finder"
-- get desktop dimensions (dw = desktop width; dh = desktop height)
set db to bounds of window of desktop
set {dw, dh} to {item 3 of db, item 4 of db}
end tell