Skip to content

Instantly share code, notes, and snippets.

View jessejlt's full-sized avatar

Jesse Thompson jessejlt

View GitHub Profile
@jessejlt
jessejlt / gist:1025732
Created June 14, 2011 19:57
dim background on mouse-over
#login {
z-index: 2;
}
#login:after {
content: "";
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
@jessejlt
jessejlt / elasticsearch.yml
Created August 19, 2011 21:47
EalsticSearch synonym configuration
# The cluster name
cluster.name: media
# Path Settings
#path.conf: /path/to/conf
#path.data: /path/to/data
#path.work: /path/to/work
#path.logs: /path/to/logs
@jessejlt
jessejlt / client_side_script.js
Created September 9, 2011 18:34
nginx & socket.io
var socket = io.connect('http://mydomain.com:4000');
@jessejlt
jessejlt / about.txt
Created October 23, 2011 03:20
nginx, flask, and file downloads
Okay so here's the setup:
[-] The primary server API is exposed via Flask (Python) and all static files, including all html, css, js is served by nginx.
[-] Python is exposing an API at url http://domain.com/api/download/<file_id>, where file_id is a database id for the file that we're interested in downloading.
1. User wants to download a file, so we spawn a new window with the url '/api/download/<file_id>'
2. Nginx intercepts the request, sees that it starts with /api/, and then forwards the request to Flask, which is being served on port 5000.
3. Flask routes the request to its download method, retrieves the pertinent data from the file_id, and constructs additional header settings to make nginx happy and to force the browser to see the file stream as a download request instead of the browser just trying to open the file in a new window. Flask then returns the modified header stream to nginx
4. Nginx is finally ready to do some work. While parsing the headers for the incoming request, it encounters "X
# nuke the database
curl -XDELETE localhost:9200/test
# post 3 items, 2 of which have the same <type>
curl -XPOST localhost:9200/test/item -d '
{
"color": "yellow",
"type": "crayon"
}'
curl -XDELETE localhost:9200
curl -XPOST localhost:9200/test/tools -d '
{
"type": "crayon",
"color": "red"
}'
curl -XPOST localhost:9200/test/tools -d '
{
@jessejlt
jessejlt / nginx.conf
Created March 23, 2012 17:20
Flask + nginx + uwsgi
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:4050;
}
@jessejlt
jessejlt / command line example
Created April 6, 2012 19:37
nosetests running a single test programmatically
$ nosetests flask.testsuite.testing:TestToolsTestCase.test_environ_defaults
.
----------------------------------------------------------------------
Ran 1 test in 0.014s
OK
@jessejlt
jessejlt / master.yml
Created May 14, 2012 19:02
ElasticSearch zen unicast discovery
cluster.name: elasticsearch_media
node.name: "media-dev"
node.master: true
node.data: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["153.32.228.250[9300-9400]", "10.122.234.19[9300-9400]"]
@jessejlt
jessejlt / about.md
Created July 2, 2013 06:11
Some ECMAScript 6 features I'm excited about