Skip to content

Instantly share code, notes, and snippets.

// Step 1: Get an API key here: https://developers.google.com/url-shortener/v1/getting_started#APIKey
// Step 2: Paste your api key below
// Step 3: Add the code below to your browser as a bookmark
// Step 4: Visit a non-goo.gl URL and click your bookmark
// NOTE: The security policy of some sites (such as this gist.github.com!) will prevent this from working.
// Check your javascript console if something doesn't work.
javascript:(function(){
var googleApiKey = 'INSERT YOUR API KEY HERE';
@git2358
git2358 / bookmarklet.url
Last active November 1, 2018 05:51 — forked from sv-in/bookmarklet.url
JS: Bookmarklet for displaying QR code of current URL (good for presentations)
javascript:void !function(max,sizes,index,image,size,style){while(index--&&(size=sizes[index])>max);style=image.style,style.position="fixed",style.zIndex=-1>>>1,style.top=style.left="50%",style.marginTop=style.marginLeft=size/-2+"px",style.imageRendering="pixelated",style.mixBlendMode="overlay",image.setAttribute("id","imageQR"),image.setAttribute("onclick","returnfalse;"),image.setAttribute("onmousedown","imageQR.remove()"),image.src="https://chart.apis.google.com/chart?cht=qr&chld=H|0&chs="+size+"x"+size+"&chl="+escape(location)}(Math.min(top.innerHeight,top.innerWidth),[100,150,200,250,300,350,400,500],8,document.body.appendChild(new Image))
@git2358
git2358 / gist:33766c2da6b54b43410f0986474b21a3
Created November 11, 2018 10:10 — forked from rmondello/gist:b933231b1fcc83a7db0b
Exporting (iCloud) Keychain and Safari credentials to a CSV file

Exporting (iCloud) Keychain and Safari credentials to a CSV file

After my dad died, I wanted to be able to have access any of his online accounts going forward. My dad was a Safari user and used iCloud Keychain to sync his credentials across his devices. I don’t want to have to keep an OS X user account around just to access his accounts, so I wanted to export his credentials to a portable file.

This is the process I used to create a CSV file of his credentials in the format “example.com,user,pass”. This portable format would be pretty easy to import into 1Password or Safari in the future.

The way I went about this isn’t great; it opens up more opportunities for apps to control one’s Mac through Accessibility APIs, it writes plaintext passwords to disk, and it could use some cleaning up. A better approach might leverage the security command line tool that ships with OS X. That said, I found this method to be a fun illustration of what’s possible us

@git2358
git2358 / gist:ebbecc2ce76c8ff9f16f07c8a29166f7
Created February 1, 2019 01:11 — forked from a-laughlin/gist:1035d616c666271e1fe3
Bookmarklet to quickly switch between a repo and the gh-pages (github.io) view.
// Instructions. Save as a bookmark. Click when on a repo or github.io (gh-pages branch) site.
javascript:(function(h,p){
location = /io$/.test(h) ?
'https://github.com/' + h.split('.')[0] + p:
'http://'+ p.split('/')[1]+'.github.io'+ '/' + p.split('/').slice(2).join('/')
})(location.host,location.pathname);
@git2358
git2358 / gist:9c58cad3362a26ea9ac139a4bcf0e654
Last active March 13, 2019 23:05 — forked from karlgroves/gist:7544592
Get DOM path of an element
function getDomPath(el) {
var stack = [];
while ( el.parentNode != null ) {
console.log(el.nodeName);
var sibCount = 0;
var sibIndex = 0;
for ( var i = 0; i < el.parentNode.childNodes.length; i++ ) {
var sib = el.parentNode.childNodes[i];
if ( sib.nodeName == el.nodeName ) {
if ( sib === el ) {
@git2358
git2358 / Auto-refresh bookmarklet
Created March 28, 2019 23:19 — forked from eculver/Auto-refresh bookmarklet
Auto-refresh bookmarklet
// origin: http://www.google.com/support/forum/p/Chrome/thread?tid=1a37ccbdde5902fd&hl=en
javascript:
timeout=prompt("Set timeout [s]");
current=location.href;
if(timeout>0)
setTimeout('reload()',1000*timeout);
else
location.replace(current);
function reload(){
@git2358
git2358 / mailTo.js
Created April 9, 2019 02:29 — forked from nrn/mailTo.js
Bookmarklet to mail a link/selected text
javascript:(function () {
var selected = getSelection().toString();
if (selected !== "") selected = '"...\n'+selected+'\n..."\n';
location.href = 'mailto:?SUBJECT='+encodeURIComponent(document.title)+'&BODY='+encodeURIComponent('\n'+location.href+'\n'+selected);
})()
@git2358
git2358 / HTML Application.hta
Created May 3, 2019 03:51 — forked from drewchapin/HTML Application.hta
Template for an HTML Application file (.hta), add to C:\Windows\ShellNew, and add ShellNew\Filename="HTML Application.hta" to .hta HKCR key.
<html>
<head>
<!--
@tag hta:application
@attribute ApplicationName Sets the name of the HTA.
@attribute Border [Thick]|Thin|None
@attribute BorderStyle [Normal]|Raised|Sunken|Complex|Static
@attribute Caption [Yes]|No
@git2358
git2358 / hello_world.asm
Created May 12, 2019 23:04 — forked from camsaul/hello_world.asm
Hello World in NES (6502 / NESASM) Assembly. Display a single sprite
;;; -*- tab-width: 2 -*-
;;; These four lines go at the beginning of almost every code file. 16-byte iNES header
.inesprg 1 ; one bank of program code
.ineschr 1 ; one bank of picture data
.inesmap 0 ; we use mapper 0
.inesmir 1 ; Mirror setting always 1
;;; BANKING
@git2358
git2358 / readme.md
Created June 14, 2019 03:03 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph