Skip to content

Instantly share code, notes, and snippets.

View kennyledet's full-sized avatar

Kendrick Von Ledet kennyledet

View GitHub Profile
"use strict";
var httpProxy = require('http-proxy'),
http = require('http'),
accesslog = require('access-log'),
addresses;
var LISTENPORT = 80; //port we're listening to the outside world
var METEORPORT = 3000; //port meteor is run on the guests
var MINIP = 10; //Minimum IP address we can use. Smaller numbers are for admin purposes

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.
@kennyledet
kennyledet / email_with_attachments.py
Created April 27, 2013 22:16
Shows how to access Gmail (or any other IMAP4 server) for new messages under a certain folder or label name. Comments are fairly straightforward; shows how to also get attachments if any exist.
import imaplib
folder_name = 'Inbox'
gm = imaplib.IMAP4_SSL('imap.gmail.com', 993)
gm.login('youraddress@gmail.com', 'password')
status, data = gm.select(folder_name) # select() can select by label or folder name
if status: status, data = gm.search(None, 'UNSEEN') # get new messages only