Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View springcoil's full-sized avatar

Peadar Coyle springcoil

View GitHub Profile
@springcoil
springcoil / gist:3231352
Created August 1, 2012 22:41 — forked from swannodette/gist:3217582
sudoku_compact.clj
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
(defn init [vars hints]
@springcoil
springcoil / gist:5480336
Created April 29, 2013 08:22
Python Traceback error, from Ipython code. Basically I attempted to replicate by writing myself the Sean J.Taylor code.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-34-180a07193cfb> in <module>()
21 for eval_name, evaluation in evaluations.iteritems():
22 for year in range(2002, 2013):
---> 23 metric = evaluation(ranker, year)
24 results.append({
25 'rank': name,
<ipython-input-34-180a07193cfb> in <lambda>(rank, year)
@springcoil
springcoil / Fizzbuzz.py
Created April 9, 2014 14:00
Fizz Buzz in one line in python
for x in range(100): print x%3/2*'Fizz'+x%5/4*'Buzz' or x+1
@springcoil
springcoil / MongoDB_Experiment_IPython
Created May 21, 2014 14:19
IPython Notebook - for MongoDB
{
"metadata": {
"name": "",
"signature": "sha256:2c5a94596837b925899f0aab294f5a5d31a0c6227abf97c00b871ecbe116bcdf"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@springcoil
springcoil / Postgres_Fun
Created June 18, 2014 12:03
CSVKit and PostgreSQL
csvsql --db postgresql:///test1 --insert Problem_Set_Operations_Research.csv
# I was having some trouble getting a csv file inserted into a Postgres Database. The above line worked.
\dt
#Shows the tables in a particular database
\connect test1
#Connects to a database with a particular name in the case above "test1"
# -*- coding: utf-8 -*-
"""
LICENSE: BSD (same as pandas)
example use of pandas with oracle mysql postgresql sqlite
- updated 9/18/2012 with better column name handling; couple of bug fixes.
- used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle.
to do:
save/restore index (how to check table existence? just do select count(*)?),
finish odbc,
@springcoil
springcoil / datascienceRscript
Created August 19, 2014 11:55
Coursera UW: Introduction to Data Science
install.packages("caret")
install.packages("rpart")
install.packages("tree")
install.packages("randomForest")
install.packages("e1071")
install.packages("ggplot2")
table <- read.csv("DataSciIntro/assignment5//seaflow_21min.csv")
library("caret")
library("rpart")
@springcoil
springcoil / datascienceRscript
Created August 19, 2014 11:56
Coursera UW: Introduction to Data Science
install.packages("caret")
install.packages("rpart")
install.packages("tree")
install.packages("randomForest")
install.packages("e1071")
install.packages("ggplot2")
table <- read.csv("DataSciIntro/assignment5//seaflow_21min.csv")
library("caret")
library("rpart")
@springcoil
springcoil / Logistic_Regression_Kzggle.py
Last active April 7, 2016 06:11
Logistic_Regression_Kaggle
__author__ = 'Miroslaw Horbal'
__email__ = 'miroslaw@gmail.com'
__date__ = '14-06-2013'
from numpy import array, hstack
from sklearn import metrics, cross_validation, linear_model
from scipy import sparse
from itertools import combinations
import numpy as np
@springcoil
springcoil / installpythonframeworks.sh
Created September 12, 2014 11:44
pip install matplotlib
#!/bin/bash
virtualenv .env &&
source .env/bin/activate &&
sudo apt-get install -y libevent-dev &&
sudo apt-get install -y libyaml-0-2 &&
sudo apt-get install --yes --force-yes automake autoconf libtool* gfortran &&
sudo apt-get install --yes --force-yes liblapack-dev &&
sudo apt-get install --yes --force-yes binutils &&
sudo apt-get install -y libatlas-dev &&
sudo apt-get install -y build-essential --upgrade &&