Skip to content

Instantly share code, notes, and snippets.

@voltrevo
voltrevo / phrases.md
Last active May 2, 2024 17:56
Test bip39 seedphrases

The following is a well known test seed phrase:

test test test test test test test test test test test junk

During development, it's beneficial to use seedphrases which are obviously meant for testing, so using test for the first 11 words is helpful. Since only 4 bits of 12-word bip39 seedphrases are for the checksum, 1 in 16 phrases are valid by chance. This gives us many additional options for the last word if you need more than one seedphrase:

test test test test test test test test test test test absent
{
  // json
  "foo": "bar"
}
{
 // jsonc
@voltrevo
voltrevo / idle-shutdown.sh
Last active May 6, 2021 06:03 — forked from JustinShenk/idle-shutdown.sh
Google Cloud Platform (GCP) instance idle shutdown
#!/bin/bash
echo $(date) Start
# Add to instance metadata with `gcloud compute instances add-metadata \
# instance-name --metadata-from-file startup-script=idle-shutdown.sh` and reboot
# NOTE: requires `bc`, eg, sudo apt-get install bc
# Modified from https://stackoverflow.com/questions/30556920/how-can-i-automatically-kill-idle-gce-instances-based-on-cpu-usage
threshold=0.1
@voltrevo
voltrevo / how-to-ca.md
Last active June 3, 2018 07:31
How to run your own Certificate Authority

How to run your own Certificate Authority

Concepts

  • tls
  • x509
  • https
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: black;
color: white;
width: 100vw;
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.19/system.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qs/6.5.1/qs.js"></script>
<script>
const plus = (a, b) => a + b;
const assert = x => {
if (!x) {
throw new Error('Assertion failed');
}
};
const adjustDestForCropTolerance = (rect, tol, dest) => {
const rectAspect = rect.width / rect.height;
<script>
window.addEventListener('load', () => {
const heading = unescape(location.search.slice(1));
document.title = heading;
const h1 = document.createElement('h1');
h1.style.width = '100%';
h1.style.textAlign = 'center';
h1.textContent = heading;
document.body.appendChild(h1);
});
'use strict';
const rows = Array.prototype.slice.apply(
document.querySelectorAll('.js-file-line')
);
const code = rows
.map(el =>
el.innerHTML
.replace(/<[^>]*>/g, '')
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
Hello World!
</body>
</html>