Skip to content

Instantly share code, notes, and snippets.

@bretton
bretton / inbound-liquidity-ln.md
Last active April 5, 2024 17:38
How to get Inbound Liquidity on the Lightning Network

How to get Inbound Liquidity on the Lightning Network

There are several ways you can find inbound liquidity on LN.

1. Wait

If your node is up 24x7 and you have some outgoing channels, the network will connect to you if you simply wait.

However, it might take a couple of weeks to get a significant amount of incoming liquidity, and ideally you want your outgoing liquidity to match too.

@matthewdowney
matthewdowney / segwit-xpubs.md
Created May 15, 2018 01:55
Figuring out how to get segwit balances for an HD wallet via an xpub with blockchain.info's API.

Issues with the Blockchain Info API

The blockchain.info API for XPUBs only works with Legacy Bitcoin XPUBs, whereas their web interface confusingly works with Segwit as well.

I provide a couple solutions at the end, and we end up with three useful functions:

  • legacy_wallet_balance
  • segwit_wallet_balance
  • segwit_wallet_balance_hack
@naftulikay
naftulikay / s3-cloudfront-invalidation.sh
Last active November 7, 2022 21:44
Sync a directory to S3 and invalidate the CloudFront cache for changed resources.
#!/bin/bash
# output format is like this:
# upload: index.html to s3://$BUCKET/index.html
#
# so we grab the second item which is the file path and pass that via xargs to the
# cloudfront invalidation command
aws s3 sync --sse AES256 s3://$BUCKET/ site/ | awk '{print $2;}' | \
xargs aws cloudfront create-invalidation --distribution-id $CF_DISTRO_ID --paths
@Rich-Harris
Rich-Harris / service-workers.md
Last active April 21, 2024 16:24
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@max-mapper
max-mapper / 0.md
Last active February 25, 2024 12:24
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)