Skip to content

Instantly share code, notes, and snippets.

View reduxdj's full-sized avatar

Patrick Lemiuex reduxdj

View GitHub Profile
@reduxdj
reduxdj / craiglist_scraper.py
Created April 17, 2011 02:38
Scrapes a Craisglist posting and returns an object with what it can find
"""
scrape_craigslist.py
requires libxml and BeautifulSoup
Created by Patrick Lemiuex on 2011-04-12.
MIT Open Source License
Copyright (c) 2009-2010 the original author or authors
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@reduxdj
reduxdj / using e regex and some parsing for top-level domains
Created April 24, 2011 01:43
Here's a simple function that parses out urls in text
import re
def parse_content_for_url(content):
reg = '([a-zA-Z0-9._%-]+)\.(ZW|AC|AD|AE|AERO|AF|AG|AI|AL|AM|AN|AO|AQ|AR|ARPA|AS|ASIA|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BIZ|BJ|BM|BN|BO|BR|BS|BT|BV|BW|BY|BZ|CA|CAT|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|COM|COOP|CR|CU|CV|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EDU|EE|EG|ER|ES|ET|EU|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GOV|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|INFO|INT|IO|IQ|IR|IS|IT|JE|JM|JO|JOBS|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MG|MH|MIL|MK|ML|MM|MN|MO|MOBI|MP|MQ|MR|MS|MT|MU|MUSEUM|MV|MW|MX|MY|MZ|NA|NAME|NC|NE|NET|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|ORG|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PRO|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|ST|SU|SV|SY|SZ|TC|TD|TEL|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TP|TR|TRAVEL|TT|TV|TW|TZ|UA|UG|UK|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XN|XXX|YE|YT|ZA|ZM|ZW)?'
li = re.findall(reg,content)
left_index = 0
inc = 0
for item in li:
l
@reduxdj
reduxdj / pandora_jar.js
Created November 15, 2011 16:57
Pandora ad hacker bookermarklet
/*
* Pandora has changed their dom recently and also did some insidious things
* like trying to check to see if the ads are in the body or playback occasionally
* stops at which you have to reload the page because of some random interval
* checking pandora does, although playback is resumed from the current point, thanks
* to Pandora. This doesn't happen very often, and I am working on a better fix for that.
*
* It's a total cat and mouse game, but I'll update the code regularly,
* so use at your own risk...
*
@reduxdj
reduxdj / watcher.coffee
Created June 14, 2012 11:51
WatcherUtil
fs = require 'fs'
fileUtil = require 'file'
path = require 'path'
nodeWatch = require 'nodewatch'
child_process = require 'child_process'
_ = require 'underscore'
glob = require 'glob'
util = require 'util'
exec = require('child_process').exec
#!/bin/bash
#
# Note: This is the only file you *really* need. I've copied the contents
# of the important files that are part of our git repo for easier reading
# below :)
#
# I've prefixed this file with two dots to make it rise to the top of the
# gist. you can ignore those
#
@reduxdj
reduxdj / gist:6893271
Last active March 23, 2020 10:48
QuadCopter Parts List
Here's the parts list available through http://HobbyKing.com
1x #9171000073/24723 Hobbyking KK2.0 Multi-rotor LCD Flight Control Board
4x #9351000004/25365 Turnigy Multistar 30 Amp Multi-rotor Brushless ESC 2-4S
4x #D2830-111000/28115 D2830-11 - Brushless Motors
1x #T1800 .3S.30/9369 Turnigy 1800mAh 3S 30C Lipo Pack
2x #OR017 -01001-M2/6360 Hex-nuts M2 10pc
2x #HA0505 /12307 Hex Screw M2x8 (20pcs)
1x #9329000018/22438 Slow Fly Electric Prop 8045SF (4 pc)
1x #9329000019/22439 Slow Fly Electric Prop 8045R SF (4 pc)
1x #9171000033/23140 Hobby King Quadcopter Power Distribution Board
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@reduxdj
reduxdj / app.js
Last active August 29, 2015 14:22 — forked from Tivoli/app.js
'use strict';
import React from 'react';
import Router from 'react-router';
import { canUseDOM } from 'react/lib/ExecutionEnvironment';
import routes from './routes';
let app = {
start(bootstrap) {
return canUseDOM ? this.webStart() : this.serverStart(bootstrap);
@reduxdj
reduxdj / app.js
Last active August 29, 2015 14:22 — forked from Tivoli/app.js
'use strict';
import React from 'react';
import Router from 'react-router';
import { canUseDOM } from 'react/lib/ExecutionEnvironment';
import routes from './routes';
let app = {
start(bootstrap) {
return canUseDOM ? this.webStart() : this.serverStart(bootstrap);
Accounts.updateOrCreateUserFromExternalService = function( // 1104
serviceName, serviceData, options) { // 1105
options = _.clone(options || {}); // 1106
// 1107
if (serviceName === "password" || serviceName === "resume") // 1108
throw new Error( // 1109
"Can't use updateOrCreateUserFromExternalService with internal service " // 1110
+ serviceName); // 1111
if (!_.has(serviceData, 'id'))