Skip to content

Instantly share code, notes, and snippets.

View charlesreid1's full-sized avatar
💭
🍒 🍍 🍓 🍊 🍌

Chaz Reid charlesreid1

💭
🍒 🍍 🍓 🍊 🍌
View GitHub Profile
$ brew install -v svn
==> Downloading http://www.apache.org/dyn/closer.cgi?path=subversion/subversion-1.7.9.tar.bz2
Already downloaded: /Library/Caches/Homebrew/subversion-1.7.9.tar.bz2
tar xf /Library/Caches/Homebrew/subversion-1.7.9.tar.bz2
==> ./configure --disable-debug --prefix=/usr/local/Cellar/subversion/1.7.9 --with-apr=/usr/local/Library/ENV/4.3 --with-ssl --with-zlib=/usr --with-sqlite=/usr/local/opt/sqlite --with-serf=/usr/local/opt/serf --disable-neon-version-check --disable-mod-activation --disable-nls --without-apache-libexecdir --without-berkeley-db
./configure --disable-debug --prefix=/usr/local/Cellar/subversion/1.7.9 --with-apr=/usr/local/Library/ENV/4.3 --with-ssl --with-zlib=/usr --with-sqlite=/usr/local/opt/sqlite --with-serf=/usr/local/opt/serf --disable-neon-version-check --disable-mod-activation --disable-nls --without-apache-libexecdir --without-berkeley-db
configure: Configuring Subversion 1.7.9
configure: creating config.nice
checking for gcc... cc
checking whether the C compiler wo
@charlesreid1
charlesreid1 / gist:5753342
Created June 10, 2013 23:24
output of ```brew install -v svn```
$ brew install -v svn
==> Downloading http://www.apache.org/dyn/closer.cgi?path=subversion/subversion-1.7.10.tar.bz2
Already downloaded: /Library/Caches/Homebrew/subversion-1.7.10.tar.bz2
tar xf /Library/Caches/Homebrew/subversion-1.7.10.tar.bz2
==> ./configure --disable-debug --prefix=/usr/local/Cellar/subversion/1.7.10 --with-apr=/usr/local/Library/ENV/4.3 --with-ssl --with-zlib=/usr --with-sqlite=/usr/local/opt/sqlite --with-serf=/usr/local/opt/serf --without-neon --disable-mod-activation --disable-nls --without-apache-libexecdir --without-berkeley-db
./configure --disable-debug --prefix=/usr/local/Cellar/subversion/1.7.10 --with-apr=/usr/local/Library/ENV/4.3 --with-ssl --with-zlib=/usr --with-sqlite=/usr/local/opt/sqlite --with-serf=/usr/local/opt/serf --without-neon --disable-mod-activation --disable-nls --without-apache-libexecdir --without-berkeley-db
configure: Configuring Subversion 1.7.10
configure: creating config.nice
checking for gcc... cc
checking whether the C compiler works... yes
@charlesreid1
charlesreid1 / gist:6877038
Last active December 24, 2015 22:59
PyEvolve Simple Program
from pyevolve import G1DBinaryString
from pyevolve import GSimpleGA
# http://pyevolve.sourceforge.net/ simple genetic algorithm example
genome = G1DBinaryString.G1DBinaryString(30)
genome.evaluator.set(lambda chromosome: sum(chromosome))
ga = GSimpleGA.GSimpleGA(genome)
ga.evolve(freq_stats=10)
print ga.bestIndividual()
@charlesreid1
charlesreid1 / gist:6877075
Created October 7, 2013 23:52
Simplified Dijsktra's algorithm
# Simplified Dijsktra's Algorithm
# from http://code.activestate.com/recipes/119466/
def shortest_path(G, start, end):
def flatten(L): # Flatten linked list of form [0,[1,[2,[]]]]
while len(L) > 0:
yield L[0]
L = L[1]
q = [(0, start, ())] # Heap of (cost, path_head, path_rest).
def Trigger_GC():
import serial
import time
GC_Trigger_Port = serial.Serial(12,9600,timeout = 1)
bytesEnable = bytearray([254, 248])
bytesOn = bytearray([254, 1])
bytesOff = bytearray([254, 0])
GC_Trigger_Port.write(bytesEnable)
GC_Trigger_Port.write(bytesOn)
time.sleep(2)
@charlesreid1
charlesreid1 / SingletonWrapper.py
Last active August 29, 2015 14:05
Python Singleton Wrapper (Design Pattern)
class ExpensiveObjectToCreate(object):
'''Insert code here'''
pass
def __init__(self,**kwargs):
self.params = kwargs
def check(self):
print self.params
== Chess Games and Positions in Neo4j
:neo4j-version: 2.0.0
:author: Wes Freeman
:twitter: @wefreema
:tags: chess
The goal is to load a bunch of chess games into Neo4j for further analysis. Scores listed are Stockfish's take on a position after a 25 move horizon (but this number can be deepened as the graph is filled out or as more processing is done). Positions can also be loaded as alternative moves (not connected to a game) based on suggestions from Stockfish. The positions are recorded as link:http://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation[FEN], a human-readable/compressed chess board state notation.
=== Schema diagram
@charlesreid1
charlesreid1 / correlation.cpp
Last active August 29, 2015 14:05
Correlation coefficient for two T-dimensional vectors
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
#include <string>
using namespace std;
/// The sums() function computes several sums from vectors x and y,
/// and stores the values in a, b, c, d, and e

NOTE: This how-to was written for the Census API at http://thedataweb.rm.census.gov/ -- it has since been moved to http://api.census.gov/

Mike Stucka, our contact at the Macon Telegraph, sent us a link to the Census's official API which is launching next month. You can skip ahead to the site - http://www.census.gov/developers/ - and get an API key, but also read my notes after using this yesterday:

  1. The datasets

--- The 2010 Census Summary comes from everyone filling out census forms, and you can get stats at state level down to a super-detailed block level. Info from this includes population, age, gender, race, home ownership, members of a household, and various combinations of that. Full list: http://www.census.gov/developers/data/sf1.xml

--- The 2006-2010 American Community Survey is a longer form given to fewer households over 5 years (so its numbers are incompatible with the 2010 Census). You can get stats down only to the block group level. In addition to the standard census stats, you get: educa

@charlesreid1
charlesreid1 / gist:28299e1977c832b163e3
Last active March 24, 2023 05:51
Gist illustrating how to connect to a GE Proficy iHistorian OLEDB instance from Python. This uses the PyADO library (http://pyado.sourceforge.net).
import PyADO
#print help(PyADO.connect)
conn = PyADO.connect(None,host='localhost',user='',password='',provider='iHOLEDB.iHistorian.1')
print conn
curs = conn.cursor()
curs.execute("SELECT * FROM ihTags")