Skip to content

Instantly share code, notes, and snippets.

icook /
Last active August 29, 2015 13:59
How to update BAMT to easily switch miners
  1. Change lines 386-390 in /opt/bamt/gpumon from

     if (${$conf}{'settings'}{'scrypt-adaptive-N'}) {
       system("screen -r vertminer");
     } else {
       system("screen -r cgminer");


icook /
Created July 13, 2014 21:56
A simple benchmark of how long the redis keys command takes to run at various keyspace sizes.
import random
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=15)
def rand_str(N):
return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(N))
icook / gist:a58006b63aefca2f726e
Created September 9, 2014 23:06
Terrible hacky fix
diff --git a/ b/
index 1619883..ad70f5b 100755
--- a/
+++ b/
@@ -9,7 +9,7 @@ from flask.ext.migrate import MigrateCommand
from simplecoin import create_manage_app, db, currencies, powerpools
from simplecoin.scheduler import SchedulerCommand
-from simplecoin.models import Transaction, UserSettings, Credit, ShareSlice, DeviceSlice
+from simplecoin.models import Transaction, UserSettings, Credit, ShareSlice, DeviceSlice, Block
icook / gist:d6532b2de1020e08a32e
Created September 10, 2014 00:18
Fix wrong SQLA polymorphic
+def fix_credits():
+ from simplecoin.models import CreditExchange
+ credit_table = Credit.__table__
+ credit_exc_table = CreditExchange.__table__
+ for credit in Credit.query.options(db.joinedload('block')).order_by(
+ correct = 1
+ if credit.block and credit.block.currency == credit.currency:
+ correct = 0
icook /
Last active August 29, 2015 14:08
How to secure your wallet

Cryptocurrency is powerful because it gives you complete control over your money, but this also puts the responsibility of proper security and procedures completely with you. As part of SimpleCrypto's goal of advancing cryptocurrency accessibility we've put together an educational article on how to properly secure your wallets and ensure that your funds are safe at all times.

Which wallet?

All cryptocurrencies use a "wallet" of some kind. A wallet is a program that allows you to send and recieve cryptocurrency. Well established currencies

# Easy alias for switching to perform actions as another
# user, even if they have no login shell
as_other() {
pushd `eval echo ~$1`
sudo -H -u $1 -s /bin/bash
alias as=as_other
blocks = list of all the blocks in the current chain
fork_number = the block height we'll fork to new adjustment algorithm at
coins_distributed = 0
for block in blocks:
# This block template doesn't have subsidy information, IE, we don't know
# how much was paid out in the coinbase
if block.height < fork_number:
# using the regular subsidy adjustment schedule and determine what the coinbase would have been at this height
coins_distributed += subsidy for this block
# Run script with wget --no-check-certificate -O - | sh
sudo apt-get -y install curl
# rethinkdb
sudo add-apt-repository ppa:rethinkdb/ppa
sudo apt-get update
sudo apt-get install rethinkdb
# nodejs
icook / gist:5400173
Last active December 16, 2015 07:39
Simple script to easily add ssh local key to authorized_keys. Execute as mkautosh
if [ -e ~/.ssh/ ];
echo "SSH Key already exists on local machine"
echo "Generating SSH key on local machine"
ssh-keygen -t rsa
chmod -R 700 ~/.ssh
icook / gist:5703616
Last active December 18, 2015 01:28
This program is meant for an Arduino Mega 2560 and is used as the control system
for the 2012 Jayhawk Motorsports Electric Car.
Author: Aric Beaver
Date: 4/06/2012
Version: 2
Specifications: This is the second version of this code that uses the throttle
sensor, brake sensor, accelerometer, wheel speed sensors, CANBUS system for