Skip to content

Instantly share code, notes, and snippets.

@mgiachetti
mgiachetti / joinWallets.js
Last active January 4, 2018 14:13
join multiple bitcoin wallets or transactions into a single wallet
// 100,000,000 satoshi = 1 btc = 1e8 satoshi
// 100,000 satoshi = 0.001 btc = 1e5 satoshi
const bitcoin = require('bitcoinjs-lib');
const network = bitcoin.networks.bitcoin;
const blockchainInfoNetwork = network === bitcoin.networks.bitcoin ? 0 : 3; // bitcoin or testnet
const blockexplorer = require('blockchain.info/blockexplorer').usingNetwork(blockchainInfoNetwork);
const pushtx = require('blockchain.info/pushtx').usingNetwork(blockchainInfoNetwork);
// const destAddr = 'mfdC1bTbar2WVAkmSMjejyiFFp6Rtyq8vW'; // testnet
@mgiachetti
mgiachetti / split-into-wallets.js
Last active January 22, 2018 14:02
Paper wallets generator. Gift cards. (Warning: wallets.json is overwritten in every run and creates new wallets. Be carefull and save it before the next run)
// 100,000,000 satoshi = 1 btc
// 100,000 satoshi = 0.001 btc = 1e5
const bitcoin = require('bitcoinjs-lib');
const network = bitcoin.networks.bitcoin;
const blockchainInfoNetwork = network === bitcoin.networks.bitcoin ? 0 : 3; // bitcoin or testnet
const blockexplorer = require('blockchain.info/blockexplorer').usingNetwork(blockchainInfoNetwork);
const pushtx = require('blockchain.info/pushtx').usingNetwork(blockchainInfoNetwork);
const sourceWIF = ''; // put private key here
@mgiachetti
mgiachetti / add voice messages to slack - index.js
Last active July 26, 2018 15:19
Add voice messages to slack. Append this code at the end of the file /Applications/slack.app/Contents/Resources/app.asar.unpacked/index.js (this works on windows too)
// node electron
const { remote } = require('electron')
const currentWindow = remote.getCurrentWindow()
// document.addEventListener('mousedown', function() {
// remote.BrowserWindow.getAllWindows().forEach(function(win) {
// win.webContents.openDevTools({mode: 'detach'});
// });
// remote.getCurrentWindow().getBrowserView().webContents.openDevTools({mode: 'detach'});
@mgiachetti
mgiachetti / doom.js
Created February 4, 2021 13:00
Script to run doom on Mural.
// @ts-check
function delay(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
function avgColor(data, x0, y0, width, height, dist) {
const color = [0, 0, 0, 0];
for (let y = 0; y < dist; y++) {