Skip to content

Instantly share code, notes, and snippets.

View ghl3's full-sized avatar

George Lewis ghl3

View GitHub Profile
@notbanker
notbanker / lichess.py
Created March 21, 2016 21:31
Get some random middlegame positions from actual games on www.lichess.org
import json
import urllib2
import time
import pandas as pd
def fen_examples( max_users = 3, max_games_per_user=10, sleep_time = 15 ):
""" Grab some real game positions from the middle of actual games, and the result """
users = users_in_team( team='coders' )
records = list()
for user in users[ :max_users ]:
@bartvm
bartvm / dl-frameworks.rst
Last active December 7, 2020 18:18
A comparison of deep learning frameworks

A comparison of Theano with other deep learning frameworks, highlighting a series of low-level design choices in no particular order.

Overview

Symbolic: Theano, CGT; Automatic: Torch, MXNet

Symbolic and automatic differentiation are often confused or used interchangeably, although their implementations are significantly different.

@tartakynov
tartakynov / fourex.py
Last active July 15, 2024 16:24
Fourier Extrapolation in Python
import numpy as np
import pylab as pl
from numpy import fft
def fourierExtrapolation(x, n_predict):
n = x.size
n_harm = 10 # number of harmonics in model
t = np.arange(0, n)
p = np.polyfit(t, x, 1) # find linear trend in x
x_notrend = x - p[0] * t # detrended x
@boates
boates / testClassificationModel.py
Last active January 16, 2019 01:37
For running sklearn classification algorithms easily on pandas data frame. Also perform tests on model accuracy.
def splitData(df, trainPerc=0.6, cvPerc=0.2, testPerc=0.2):
"""
return: training, cv, test
(as pandas dataframes)
params:
df: pandas dataframe
trainPerc: float | percentage of data for trainin set (default=0.6
cvPerc: float | percentage of data for cross validation set (default=0.2)
testPerc: float | percentage of data for test set (default=0.2)
(trainPerc + cvPerc + testPerc must equal 1.0)
@KWMalik
KWMalik / interviewitems.MD
Created September 16, 2012 22:04 — forked from amaxwell01/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@dfm
dfm / slider.js
Created September 12, 2012 20:41
Making bounding sliders with d3... see http://broiler.astrometry.net/s82/stars for a demo
(function () {
var root = this;
root.Slider = function (target, min, max, on_finish, on_change) {
var _this = this;
var w = 260, h = 20, margin = 10, radius = 5;
// On change event.
this.on_change = function () {};
@jonathansick
jonathansick / watcher.py
Created September 2, 2012 03:49
Run make whenever a LaTeX file is modified (using Python watchdog)
import subprocess
import os
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class ChangeHandler(FileSystemEventHandler):
"""React to modified .tex files."""
@dfm
dfm / _chi2.c
Created August 3, 2012 13:41
How to wrap C code in Python
#include <Python.h>
#include <numpy/arrayobject.h>
#include "chi2.h"
/* Docstrings */
static char module_docstring[] =
"This module provides an interface for calculating chi-squared using C.";
static char chi2_docstring[] =
"Calculate the chi-squared of some data given a model.";
@jzrake
jzrake / zexcept.cpp
Created May 8, 2012 17:01
Quick tutorial on runtime exceptions in C++
#include <iostream>
#include <stdexcept>
class ZrakeFailed : public std::runtime_error
{
public:
ZrakeFailed(const std::string &msg) : std::runtime_error("zraker failed. " + msg) { }
@lukekarrys
lukekarrys / README.md
Last active December 7, 2016 18:12
Pitchfork Review Score Scraper