Skip to content

Instantly share code, notes, and snippets.

@jdh7190
jdh7190 / unlock.js
Created September 10, 2023 11:14
Unlock from hodlocker
const getUTXO = (rawtx, idx) => {
const bsvtx = new bsv.Transaction(rawtx);
return {
satoshis: bsvtx.outputs[idx].satoshis,
vout: idx,
txid: bsvtx.hash,
script: bsvtx.outputs[idx].script.toHex()
}
}
const getRawtx = async txid => {
@n3dst4
n3dst4 / disable-chrome-same-origin.md
Created June 4, 2018 10:38
How to disable same-origin policy (aka CORS checking) in Chrome

You need to run Chrome with two command line flags:

--disable-web-security --user-data-dir

These are kind of documented here: https://peter.sh/experiments/chromium-command-line-switches/

--disable-web-security is the one that turns off the same-origin policy (the name is scarier than the action). Although the docs don't say this, this flag is ignored unless you also specify --user-data-dir. That's because --disable-web-security can be super risky so you shouldn't be surfing in that mode all the time, so Chrome requires you to use an alternative user profile, specified with --user-data-dir. However, you can get away with just giving --user-data-dir and not specifying a dir, and it will use the default one (so you get all your bookmarks, cookies, extension, etc. but --disable-web-security will still feel that honour has been satisfied and tuirn off same-origin policy.

// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';