Skip to content

Instantly share code, notes, and snippets.

@icook
icook / example.ipynb
Last active March 23, 2022 23:27
A little class (and python notebook) to calculate and plot the concentration and buildup of Vyvanse in your body over time.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@icook
icook / reids_keys_bench.py
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)
r.flushdb()
def rand_str(N):
return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(N))
@icook
icook / instr.md
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");
     }
    

    to

mainApp.directive "rawNgModel", ->
require: "^ngModel"
scope:
rawNgModel: '='
link: (scope, element, attrs, ngModelCtrl) ->
ngModelCtrl.$parsers.splice 0, 0, ((viewValue) ->
scope.rawNgModel = viewValue
viewValue
)
@icook
icook / runner.py
Last active December 28, 2015 17:19
A thread based runner for robot game
"""
This is a thread based comparison runner for robot game. Essentially it takes the latest
x number of scripts in a folder called "engines" and runs every combination against eachother
repeatedly. It shows simple W/L ratio to help figure out which algorithms work the best.
"""
import curses
import path
import sys
import threading
import traceback
@icook
icook / server-12.04
Last active December 23, 2015 14:19
# Install latest mongo
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | tee -a /etc/apt/sources.list.d/10gen.list
apt-get -y update
apt-get -y install mongodb-10gen
# uwsgi
apt-get install uwsgi uwsgi-plugin-python
# python setup
@icook
icook / gist:5863726
Created June 26, 2013 00:25
Jenkins Continuous Integration
# Setup a proper path, I call my virtualenv dir "venv" and
# I've got the virtualenv command installed in /usr/local/bin
PATH=$WORKSPACE/venv/bin:/usr/local/bin:$PATH
# Move the source into it's own directory
SRC_DIR=eli5
mkdir $SRC_DIR
mv * $SRC_DIR/ || :
mv .git/ $SRC_DIR/ || :
# Generate a new virtual enviroment
if [ ! -d "venv" ]; then
@icook
icook / gist:5758971
Last active December 18, 2015 09:09
SQLAlchemy + Yota example
# /// Import SQLAlchmey and flask...
import yota
from yota.nodes import *
from yota.validators import *
""" Say we have a simple SQLAlchemy table like such """
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
@icook
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
@icook
icook / gist:5400173
Last active December 16, 2015 07:39
Simple script to easily add ssh local key to authorized_keys. Execute as mkautosh me@host1.com me@host2.com
#!/bin/bash
if [ -e ~/.ssh/id_rsa.pub ];
then
echo "SSH Key already exists on local machine"
else
echo "Generating SSH key on local machine"
ssh-keygen -t rsa
chmod -R 700 ~/.ssh
ssh-add