-
-
Save kfatehi/122772563b668fa2bbbe03b1cf6e82bc to your computer and use it in GitHub Desktop.
1password duplicate remover (alpha, only run in debugger with breakpoints everywhere *g*)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// you need `op` tool for this, download it here https://support.1password.com/command-line/ | |
// create items.json like so: | |
// op list items | jq > items.json | |
// then run this script | |
// this script outputs uuids of dupes as keyed by item title, create, and modified date, | |
// feed it into the delete command like so: | |
// node process.js | xargs -I{} op delete item {} | |
const items = require('./items.json'); | |
var imap = {}; | |
var dups = []; | |
function mkhash(item) { | |
return item.title+item.createdAt+item.updatedAt; | |
} | |
for (var i=0; i<items.length; i++) { | |
var item = items[i]; | |
if (item.trashed === "Y") | |
continue; | |
var hash = mkhash(item) | |
if (imap[hash]) { | |
dups.push(item); | |
} else { | |
imap[hash] = item; | |
} | |
} | |
for (var i=0; i<dups.length; i++) { | |
console.log(dups[i].uuid) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment