Script Kit Logo
Script Kit
by John Lindquist
Free TutorialsCommunity ScriptsDocsGuideDiscussBlog
Kostas Minaidis
Scripts /

Kostas Minaidis

kostas_mns

get-the-price-of-bitcoin-using-the-bitfinex-open-api

by Kostas Minaidis

// Name: BitCoinPrice
// Description: Get latest Bitcoin price using the Bitfinex open API
// Author: Kostas Minaidis
// GitHub: @kostasx
import "@johnlindquist/kit"
let response = await get(`https://api.bitfinex.com/v1/pubticker/BTCUSD`, {
headers: {
Accept: "text/plain",
},
})
const data = response.data
await div(`
<div style="font-style:bold; padding: 1rem; font-size: 2rem;">
<p><span style="color: gray;">Price:</span> $${data.last_price}</p>
</div>
`)

find-duplicate-files

by Kostas Minaidis

// Name: FindDuplicate
// Author: Kostas Minaidis
// GitHub: @kostasx
// Supports: Mac
import "@johnlindquist/kit"
import fs from "fs"
import crypto from "crypto"
const folder = await drop();
const dir = await readdir(folder[0].path)
let content = `
| Filename | MD5 Hash |
| -------- | -------- |
`;
const hashes = {}
dir.forEach(file => {
const fullPath = `${folder[0].path}/${file}`
const stats = fs.statSync(fullPath);
if (stats.isDirectory()) { return; }
const fileData = fs.readFileSync(fullPath)
const hash = crypto.createHash('md5').update(fileData).digest('hex')
if (hashes[hash]) {
return hashes[hash].push(file)
}
hashes[hash] = [file]
})
Object.entries(hashes).forEach(([hash, listOfFiles]) => {
if (listOfFiles.length > 1) {
listOfFiles.forEach(file => {
content += `| ${file} | ${hash.slice(0,4) + "..." + hash.slice(-4)} |\n`
})
}
})
await div(md(content))
created by
John Lindquist
GitHub