JSConf.eu opening song - JavaScript Will Listen - Bella Morningstar
- Plask - Dean McNamee
- Plask
| #if INTERACTIVE | |
| #I @"C:\Tools\MongoDB-CSharp\MongoDB.Linq\bin\Debug" | |
| #r "MongoDB.Driver.dll" | |
| #r "MongoDB.Linq.dll" | |
| #r "FSharp.PowerPack.Linq.dll" | |
| #r "System.Core.dll" | |
| #endif | |
| open System | |
| open MongoDB.Driver |
| # How to echobot with XMPP, BOSH, and Strophe | |
| 1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local | |
| NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this | |
| #/etc/hosts | |
| 127.0.0.1 localhost.local | |
| NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server. | |
| 2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0) |
| #!/bin/bash | |
| #http://gist.github.com/gists/315136 | |
| SSHAGENT=/usr/bin/ssh-agent | |
| SSHAGENTARGS="-s" | |
| PARENT_JOB=pstat_master_unittest | |
| KEY_PATH=$HOME/policystat/fabric/pstat_dev.key | |
| PROJECT_ROOT=/var/www/pstattest.com/ | |
| DB_NAME=pstattest |
| import commands | |
| from fabric.api import * | |
| # Globals | |
| env.project='EBSSTRIPING' | |
| env.user = 'myuser' | |
| DEVICES = [ |
| virtualenv --no-site-packages . | |
| source bin/activate | |
| bin/pip install Django psycopg2 django-sentry | |
| bin/pip freeze > requirements.txt | |
| bin/django-admin.py startproject mysite | |
| cat >.gitignore <<EOF | |
| bin/ | |
| include/ | |
| lib/ | |
| EOF |
| # Class for managing multiple servers or anything with start() and stop() methods | |
| class ServerRack(object): | |
| def __init__(self, servers): | |
| self.servers = servers | |
| def start(self): | |
| started = [] | |
| try: |
| upstream uwsgi { | |
| ip_hash; | |
| server 127.0.0.1:40000; | |
| } | |
| server { | |
| listen 80; | |
| server_name www.domain.com; | |
| root /sites/mysite/; | |
| access_log /sites/mysite/log/nginx/access.log; |
| from gevent import monkey; monkey.patch_all() | |
| import gevent | |
| import gevent.greenlet | |
| from functools import partial | |
| from random import random | |
| import urllib | |
| import urllib2 | |
| def on_exception(fun, greenlet): |
| from PIL import Image | |
| def average_image_color(filename): | |
| i = Image.open(filename) | |
| h = i.histogram() | |
| # split into red, green, blue | |
| r = h[0:256] | |
| g = h[256:256*2] | |
| b = h[256*2: 256*3] |