Skip to content

Instantly share code, notes, and snippets.

@dschep
Last active March 3, 2020 14:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dschep/bd2803112f427fcf6ae52c85275229c7 to your computer and use it in GitHub Desktop.
Save dschep/bd2803112f427fcf6ae52c85275229c7 to your computer and use it in GitHub Desktop.
Restore AWS shortcuts
javascript:(() => {
const newSc = prompt('enter shortcuts to restore');
/* Parse cookies into a map */
const cookies = new Map(document.cookie.split(/\s*;\s*/g).map(kv => kv.split('=')));
/* decode and parse the noflush_awscnm cookie */
const noflush_awscnm = JSON.parse(decodeURIComponent(cookies.get('noflush_awscnm')));
/* set shortcuts to those input by user */
noflush_awscnm.sc = newSc.split(',');
/* set the noflush_awscnm cookie (stringified & encoded) */
document.cookie = `noflush_awscnm=${encodeURIComponent(JSON.stringify(noflush_awscnm))}`;
/* inform the user */
alert(`reset shortcuts: ${newSc}`);
})()
@dschep
Copy link
Author

dschep commented Oct 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment