Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
mainApp.directive "rawNgModel", ->
require: "^ngModel"
scope:
rawNgModel: '='
link: (scope, element, attrs, ngModelCtrl) ->
ngModelCtrl.$parsers.splice 0, 0, ((viewValue) ->
scope.rawNgModel = viewValue
viewValue
)

Acting as your own Certificate authority

For securing internal services, acting as your own CA can be very convenient. Buying a wildcard SSL cert might be too expensive, or your internal services span multiple domains, etc. A lot of people will simply use self signed certs, which are definitely better than nothing, but leave you open to MITM attacks and require clicking through warning screens frequently.

By acting as your own CA internal services can be tightly secured by requiring

@icook
icook / interblock_time.ipynb
Last active February 24, 2016 19:38
This IPython notebook generates graphs of the moving average inter-block time for a blockchain.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Product Review Exchange

Getting feedback on a new product is vital, but getting those early Eyeballs can be difficult. Why is Eyeballs capitalized? Whoknows.

  • Projects to be reviewed can be listed with simple text instructions. Basic requirements (iOS, Android, Windows, etc) will be specified to allow filtering by users.
  • Points system. When you review something the review is sent to the author for review
    • The site owner awards points based on the helpfulness of the review. 0 is spam, 10 is pivotal advice that is thorough and well explained.
  • If you post a site to review you "pay" for reviews with points.
  • Each review costs 5 points as long as you award the reviewer more than a 0.
@icook
icook / faq.md
Last active February 27, 2016 01:21
@icook
icook / hash_test.ipynb
Last active April 6, 2016 14:21
Experiment in reverse video search
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# widgets example code: check_buttons.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import CheckButtons
class LabelWrapper(str):
def __new__(cls, graph, text):
s = str.__new__(cls, text)
s.graph = graph