Skip to content

Instantly share code, notes, and snippets.

@chill117
chill117 / check-qemu-binfmt.sh
Created December 26, 2021 17:55 — forked from ArturKlauser/check-qemu-binfmt.sh
Building Multi-Architecture Docker Images With Buildx
#!/bin/bash
# (c) 2020 [email protected]
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# This script checks if all software requirements are met in a Linux environment
# in order to use 'docker buildx' to build multi-architecture images.
# For more information see:
# https://nexus.eddiesinentropy.net/2020/01/12/Building-Multi-architecture-Docker-Images-With-Buildx/
function error() {
@chill117
chill117 / reregister-qemu-binfmt.sh
Created December 26, 2021 17:55 — forked from ArturKlauser/reregister-qemu-binfmt.sh
Building Multi-Architecture Docker Images With Buildx
#!/bin/bash
# (c) 2020 [email protected]
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# This script tries to reregister QEMU's binfmt_misc handlers with the
# fix-binary (F) flag in order to be usable with 'docker buildx' to build
# multi-architecture images.
# For more information see:
# https://nexus.eddiesinentropy.net/2020/01/12/Building-Multi-architecture-Docker-Images-With-Buildx/
@chill117
chill117 / calculate-hash-collision-probability.js
Last active May 10, 2021 09:32
Use this script to calculate the probability of generating duplicate hashes given the number of possible values and the number of values generated.
// MIT License
//
// Copyright (c) 2021 Charles Hill
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

Keybase proof

I hereby claim:

  • I am chill117 on github.
  • I am chill1 (https://keybase.io/chill1) on keybase.
  • I have a public key whose fingerprint is 9A5A 7F77 6592 73D3 8D03 9A87 8BA9 7893 7688 DB3E

To claim this, I am signing this object:

@chill117
chill117 / adjust_gap_limit_to_find_address.py
Last active August 29, 2015 14:04
Automatically adjusts the gap limit in the default wallet of Electrum so that the given address is included in the list of addresses.
#!/usr/bin/env python
# Place this file in the Electrum scripts directory. Then run from command line, like this: `~/.electrum/scripts/adjust_gap_limit_to_find_address.py`.
import sys
from electrum import bitcoin, Network, print_json, SimpleConfig, Wallet, WalletStorage
try:
addr = sys.argv[1]
except Exception:
print 'Usage: ' + sys.argv[0] + ' <bitcoin_address>'
@chill117
chill117 / watch.py
Last active August 29, 2015 14:04
Watches for new transactions in the default wallet of Electrum. When a new transaction is received at an address, the full history of that address is printed to the console.
#!/usr/bin/env python
# Place this file in the Electrum scripts directory. Then run from command line, like this: `~/.electrum/scripts/watch.py`.
import sys, time
from electrum import Network, print_json, SimpleConfig, Wallet, WalletStorage
def initialize():
config = SimpleConfig()
@chill117
chill117 / get_address_by_index.py
Last active August 29, 2015 14:04
Get an address by its index from the default wallet in Electrum.
#!/usr/bin/env python
# Place this file in the Electrum scripts directory. Then run from command line, like this: `~/.electrum/scripts/get_address_by_index.py <index>`.
import sys
from electrum import SimpleConfig, Wallet, WalletStorage
try:
index = int(sys.argv[1])
except Exception:
print 'Usage: ' + sys.argv[0] + ' <index>'
@chill117
chill117 / get_address_history.py
Last active April 29, 2024 14:40
Get full transaction history for an address in your default Electrum wallet.
#!/usr/bin/env python
# Place this file in the Electrum scripts directory. Then run from command line, like this: `~/.electrum/scripts/get_address_history.py <bitcoin_address>`.
import sys
from electrum import bitcoin, Network, print_json, SimpleConfig, Wallet, WalletStorage
try:
addr = sys.argv[1]
except Exception:
print 'Usage: ' + sys.argv[0] + ' <bitcoin_address>'
@chill117
chill117 / start_stop_restart.sh
Created July 6, 2014 18:47
A simple bash script for starting/stopping/restarting an application or service.
#!/bin/bash
#
# A simple bash script for starting/stopping/restarting an application or service.
#
start()
{
# Your start application code goes here.
}
@chill117
chill117 / prune_backups.sh
Created August 15, 2013 19:57
Automatically delete old backup files.
#!/bin/bash
#
# Use this script to automatically delete old backup files.
#
declare -i max_age
# Number of days to keep backup files.
max_age=10