Skip to content

Instantly share code, notes, and snippets.

View dandrews's full-sized avatar
🏠
Working from home

Dan Andrews dandrews

🏠
Working from home
View GitHub Profile
@dandrews
dandrews / bash diff between directories
Created August 6, 2012 17:49
list the files that are different between two directories, excluding directories that match specific patterns
# https://snipt.net/dandrews/list-the-files-that-are-different-between-two-directories-excluding-directories-that-match-specific-patterns/
diff --brief -r -x '.git' -x 'tmp' /path/to/dir1 /path/to/dir2
@dandrews
dandrews / angellist_get_request.js
Created December 29, 2012 22:31
An example making a secure GET request to the AngelList API, using Node.js. The results are written to a file. Invoke from the command line with: node angellist_get_request.js
var https = require('https');
var fs = require('fs');
var key_token = 'your_access_token'; // optional
var startup_id = '6702'; // AngelList
// options for GET
var optionsget = {
host : 'api.angel.co',
port : 443,
@dandrews
dandrews / mentor_urls.js
Last active December 11, 2015 01:59
Scrape all the URLs for the individual mentors on http://www.techstars.com/program/mentors/#all, using CasperJS
var url = 'http://www.techstars.com/program/mentors/#all';
var casper = require('casper').create({
// verbose: true,
// logLevel: 'debug',
pageSettings: {
loadImages: false,
loadPlugins: false
}
});
@dandrews
dandrews / dto-org-gtd.el
Created January 26, 2013 21:19
David O'Toole's org-mode configuration for Getting Things Done
;;; dto-org-gtd.el --- dto's org-mode configuration for GTD
;;; http://orgmode.org/worg/code/elisp/dto-org-gtd.el
;; Copyright (C) 2007 David O'Toole
;; Author: David O'Toole(require 'org) <dto@gnu.org>
;; Keywords: tools
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
import sys
import subprocess
import tempfile
import urllib
text = sys.stdin.read()
chart_url_template = ('http://chart.apis.google.com/chart?'
'cht=qr&chs=300x300&chl={data}&chld=H|0')
chart_url = chart_url_template.format(data=urllib.quote(text))
@dandrews
dandrews / get_angel_tags.js
Created April 11, 2013 00:26
Scrape Market tags from http://angel.co/markets using CasperJS. This script is a basic example, and so it doesn't click any of the dropdown arrows or the 'More' buttons, so it only returns the top-level tags.
var utils = require('utils');
var markets_url = 'https://angel.co/markets';
var casper = require('casper').create({
// verbose: true,
// logLevel: 'debug',
pageSettings: {
loadImages: false,
loadPlugins: false
@dandrews
dandrews / mentors.js
Created April 11, 2013 16:24
Scrape mentors details from http://www.techstars.com/program/mentors/#all using CasperJS
var url = 'http://www.techstars.com/program/mentors/#all';
var casper = require('casper').create({
// verbose: true,
// logLevel: 'debug',
pageSettings: {
loadImages: false,
loadPlugins: false
}
});
@dandrews
dandrews / AngelList Markets
Created April 11, 2013 19:48
All AngelList Markets tags, sorted alphabetically. Scraped from https://angel.co/markets on 4/11/2013.
Accounting
Active Lifestyle
Ad Targeting
Adult
Advanced Materials
Adventure Travel
Advertising
Advertising Exchanges
Advertising Networks
Advertising Platforms

Create an .htaccess file in the webroot:

AuthUserFile /app/www/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user

Create a .htpasswd file:

htpasswd -c /app/www/.htpasswd [username]

'''
odds of winning: .5776398
odds of losing: .4223602
odds of winning game after winning 1: 23/34 .67647059
odds of winning game after winning 2: 15/23 .65217391
odds of winning game after winning 3: 9/15 .60000000
odds of winning game after winning 4: 7/9 .77777778
odds of winning game after winning 5: 3/7 .42857143
odds of winning game after winning 6: 2/3 .66666667