Skip to content

Instantly share code, notes, and snippets.

View AnthonyNystrom's full-sized avatar

Anthony Nyström AnthonyNystrom

View GitHub Profile
@anthonygarvan
anthonygarvan / BotOrNotCoreLogic.py
Last active August 29, 2015 14:04
This is the bot logic behind the game Bot or Not, a crowdsourced Turing test. Learn more at www.anthonygarvan.com.
class Repository:
def __init__(self):
mongo_uri = 'mongodb://localhost:27017/master'
db_name = 'master'
self.client = MongoClient(mongo_uri)
self.db = self.client[db_name]
self.messages = self.db.messages
self.partner_queue = self.db.partner_queue
self.default_messages = ['Sorry I don\'t get that.',
'DOES NOT COMPUTE',
@dutc
dutc / notes.md
Last active March 11, 2025 09:16
CPython workshop

themes

  1. CPython for greater understanding of the Python programming language (but "reference implementations always overspecify") Reading source to solve problems
  2. getting involved, contributing to the project

introduction

This workshop will cover the basics of the CPython runtime and interpreter. There is an enormous amount of material to cover, and I'll try to to rush through as much as I can.

# coding=UTF-8
from __future__ import division
import nltk
import re
import requests
# Add your freebase key here
# If you don't have one, register at https://code.google.com/apis/console
FREEBASE_KEY = ""
@robmiller
robmiller / git-cleanup-repo
Last active October 14, 2025 20:53
A script for cleaning up Git repositories; it deletes branches that are fully merged into `origin/master`, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
#!/bin/bash
# git-cleanup-repo
#
# Author: Rob Miller <rob@bigfish.co.uk>
# Adapted from the original by Yorick Sijsling
git checkout master &> /dev/null
# Make sure we're working with the most up-to-date version of master.
git fetch
@alexbw
alexbw / skeletonize.py
Created February 24, 2012 17:47
Skeletonizing an image
import SimpleCV as scv
import scipy.ndimage as ndimage
radius = 5
# Grab a little blobby image from the interwebs (it's a picture of a mouse, taken with the Microsoft Kinect)
scv_img = scv.Image("http://i.imgur.com/mGg0V.png")
# Grab a grayscale layer of the image
img = scv_img.getNumpy()[:,:,0]
@Mindelusions
Mindelusions / app.js
Created October 7, 2011 15:58
LeatherFace Application Code
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup({
backgroundImage:'/images/tabbar.png'
});
// Component Creation
@smilbandit
smilbandit / .htaccess
Created May 27, 2011 05:46
Twitter API to RSS
RewriteEngine on
RewriteBase /twitter
RewriteRule ^(.*)$ twitter2rss.php [NC]