Skip to content

Instantly share code, notes, and snippets.

@chill117
chill117 / HostNameRouter.php
Last active October 21, 2024 18:01
Manage multiple hostnames (domains, sub-domains) within a single instance of CodeIgniter.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
Manage multiple hostnames (domains, sub-domains) within a single instance of CodeIgniter.
Example:
If you had the following domain/sub-domain style for your site:
your-domain.com
@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 / 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 Artur.Klauser@computer.org
# 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 Artur.Klauser@computer.org
# 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 / mysql_backup.sh
Last active December 13, 2021 22:02
Bash script to perform backups on one or more MySQL databases.
#!/bin/bash
#
# Use this script to perform backups of one or more MySQL databases.
#
# Databases that you wish to be backed up by this script. You can have any number of databases specified; encapsilate each database name in single quotes and separate each database name by a space.
#
# Example:
# databases=( '__DATABASE_1__' '__DATABASE_2__' )
@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 / 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
@chill117
chill117 / ExtendHttpSupport.php
Last active December 20, 2015 23:38
Adds support for PUT verb in CodeIgniter; populates PHP's $_POST data super global with data for PUT requests.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
Description:
Adds support for PUT verb in CodeIgniter; populates PHP's $_POST data
super global with data for PUT requests.
@chill117
chill117 / roman_numerals_helper.php
Created July 11, 2013 00:31
Converts an Arabic Numeral to Roman Numeral. Works for 1 through 4999.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|----------------------------------------------------------------
| Description
|----------------------------------------------------------------
Converts an Arabic Numeral to Roman Numeral.