- USB stick with a live OS (Tails or similar), for the offline session
- A second small USB stick for moving the descriptor and PSBT files between offline/online
- Paper
- Sparrow, downloaded and signature-verified on your online machine before going offline then carry the verified installer offline via USB
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
| export interface Bytes { | |
| value: number; | |
| unit: string; | |
| } | |
| /** | |
| * Convert a number of bytes into a human-readable string (e.g. "1.23 MB") | |
| * @param bytes | |
| * @param decimals How many decimal places to include | |
| */ |
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
| /** | |
| * Converts a number to a formatted string with k, m, etc. | |
| * | |
| * @param {number} num The number to format. | |
| * @param {number} [digits=1] The number of decimal places to display. Defaults to 1. | |
| * @returns {string} The formatted string. | |
| */ | |
| function formatNumber(num: number, digits: number = 1): string { | |
| if (typeof num !== 'number' || isNaN(num)) { | |
| return 'Invalid input: Not a number'; |
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
| /** | |
| * Returns an easy-to-read Date format | |
| * @param timestamp Timestamp in String on Number | |
| * @param full Return full Date | |
| * @return formatted String | |
| */ | |
| export function formatDate(timestamp: number | string, full?: boolean): string { | |
| if (!timestamp) return ''; | |
| const date = toDate(timestamp); |
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
| /*tooltip*/ | |
| [data-tooltip]:not([data-tooltip=""]) { | |
| position: relative; | |
| } | |
| [data-tooltip]:not([data-tooltip=""])::before { | |
| content: attr(data-tooltip); | |
| position: absolute; | |
| bottom: 100%; | |
| left: 50%; |
There are two main modes to run the Let's Encrypt client (called Certbot):
- Standalone: replaces the webserver to respond to ACME challenges
- Webroot: needs your webserver to serve challenges from a known folder.
Webroot is better because it doesn't need to replace Nginx (to bind to port 80).
In the following, we're setting up mydomain.com.
HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.
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
| var FB = require('fb'); | |
| FB.api('oauth/access_token', { | |
| client_id: process.env.FACEBOOK_APP_ID, | |
| client_secret: process.env.FACEBOOK_SECRET, | |
| grant_type: 'client_credentials' | |
| }, function(res) { | |
| if (!res || res.error) { | |
| console.log('error occurred when getting access token:', res && res.error); | |
| return; |
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
| // Run PostgreSQL server: | |
| // docker run -e POSTGRES_PASSWORD="" -p 5432:5432 postgres | |
| // Monitor running processes: | |
| // watch -n 1 'echo "select pid,query_start,state,query from pg_stat_activity;" | psql -h localhost -U postgres | |
| // | |
| // For all handlers, call to db takes 5 seconds, | |
| // | |
| // Three endpoints: | |
| // - "/" - take 5 seconds | |
| // - "/ctx" - take 1 seconds, due to 1 second cancellation policy |
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
| $('input[type="checkbox"]').bind('change', function() { | |
| var $checkbox = $(this); | |
| var id = this.id + '-hidden'; | |
| if ($checkbox.is(':checked')) { | |
| $('#' + id).detach(); | |
| } else { | |
| var name = $checkbox.attr('name'); | |
| $checkbox.before('<input type="hidden" name="'+ name +'" value="0" id="'+ id +'">'); | |
| } |
NewerOlder