Skip to content

Instantly share code, notes, and snippets.

@spamwax
spamwax / gist:9219112
Created February 25, 2014 22:19
cppnetlib_linker_wget_example
cd /C/Users/hamid/src/cpp-netlib/build/contrib/http_examples && /c/mingw64/bin/g++.exe -std=c++11
-Wl,--whole-archive CMakeFiles/simple_wget.dir/objects.a -Wl,--no-whole-archive
-o ../../example/simple_wget.exe -Wl,--out-implib,libsimple_wget.dll.a
-Wl,--major-image-version,0,--minor-image-version,0
../../uri/src/libnetwork-uri.a ../../http/src/libnetwork-http-v2-client.a
/c/Users/hamid/local/boost/1.55/gcc/x64/lib/libboost_system-mgw48-mt-1_55.a
/c/Users/hamid/local/boost/1.55/gcc/x64/lib/libboost_regex-mgw48-mt-1_55.a
/c/Users/hamid/local/boost/1.55/gcc/x64/lib/libboost_filesystem-mgw48-mt-1_55.a
-lws2_32
../../uri/src/libnetwork-uri.a
@spamwax
spamwax / gist:99f1a2d9f21ed463d157
Last active November 22, 2017 22:34
Solution to eloquentjavascript exercise second 2nd edition (Chapter 5) eloquent javascript
// Solution to eloquentjavascript exercise second 2nd edition
// Chapter 5
// http://eloquentjavascript.net/2nd_edition/preview/05_higher_order.html
// Mother-child age difference
function average(array) {
function plus(a, b) { return a + b; }
return array.reduce(plus) / array.length;
}
@spamwax
spamwax / eloquentjavascript_solutions_chapter_6.js
Last active July 22, 2016 16:49
Solution to eloquentjavascript exercise second 2nd edition (Chapter 6) eloquent javascript
// Solution to eloquentjavascript exercise second 2nd edition
// Chapter 6
// http://eloquentjavascript.net/2nd_edition/preview/06_object.html
// A vector type
function Vector(x, y) {
this.x = x;
this.y = y;
}
Vector.prototype.plus = function (b) {
@spamwax
spamwax / eloquentjavascript_solutions_chapter_7.js
Created June 4, 2014 19:52
Solution to eloquentjavascript exercise second 2nd edition (Chapter 7) eloquent javascript
function Plant() {
this.energy = 3 + Math.random() * 4;
}
Plant.prototype.act = function(context) {
if (this.energy > 19) {
var space = context.find(" ");
if (space)
return {type: "reproduce", direction: space};
}
if (this.energy < 20)
@spamwax
spamwax / eloquentjavascript_solutions_chapter_8.js
Last active August 29, 2015 14:02
Solution to eloquentjavascript exercise second 2nd edition (Chapter 8) eloquent javascript
// Solution to eloquentjavascript exercise second 2nd edition
// Chapter 8
// http://eloquentjavascript.net/2nd_edition/preview/08_error.html
// Retry
function MultiplicatorUnitFailure() {}
function primitiveMultiply(a, b) {
if (Math.random() < 0.5)
return a * b;
else
@spamwax
spamwax / eloquentjavascript_solutions_chapter_9.js
Last active April 27, 2023 06:53
Solution to eloquentjavascript exercise second 2nd edition (Chapter 9) eloquent javascript
// Solution to eloquentjavascript exercise second 2nd edition
// Chapter 9
// http://eloquentjavascript.net/2nd_edition/preview/09_regexp.html
// regex Golf
verify(/ca[rt]/,
["my car", "bad cats"],
["camper", "high art"]);
verify(/pr?op/,
["pop culture", "mad props"],
@spamwax
spamwax / eloquentjavascript_solutions_chapter_10.js
Created June 12, 2014 22:39
Solution to eloquentjavascript exercise second 2nd edition (Chapter 10) eloquent javascript
// Solution to eloquentjavascript exercise second 2nd edition
// Chapter 10
//http://eloquentjavascript.net/2nd_edition/preview/10_modules.html
// Month names
var month = function() {
var names = ["Jan", "Feb", "March", "April", "May", "Junte", "July", "August", "September", "October", "November", "December"];
return {
name: function(number) { return names[number];},
number: function(name) {return names.indexOf(name);}
}
@spamwax
spamwax / eloquentjavascript_solutions_chapter_10.js
Last active August 29, 2015 14:02
Solution to eloquentjavascript exercise second 2nd edition (Chapter 13) eloquent javascript
// Solution to eloquentjavascript exercise second 2nd edition
// Chapter 13
// http://eloquentjavascript.net/2nd_edition/preview/13_dom.html
// Build a table
function buildTable(data) {
var node = document.createElement("table");
var tr = document.createElement("tr");
var headers = Object.keys(data[0]);
for (var i=0; i<headers.length; ++i) {
var header = headers[i];

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

-> % ldd /usr/local/Cellar/macvim/7.4-76/MacVim.app/Contents/MacOS/Vim
/usr/local/Cellar/macvim/7.4-76/MacVim.app/Contents/MacOS/Vim:
/usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1152.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/local/lib/liblua.5.2.dylib (compatibility version 5.2.0, current version 5.2.3)