Skip to content

Instantly share code, notes, and snippets.

[program:gunicorn-graphite]
command=/usr/local/bin/gunicorn_django -u www-data -g www-data -b 127.0.0.1:8080 --log-file=/opt/graphite/storage/log/webapp/gunicorn.log /opt/graphite/webapp/graphite/settings.py
process_name=%(program_name)s
autostart=true
autorestart=true
stopsignal=QUIT
user=www-data
[program:carbon-cache]
command=python /opt/graphite/bin/carbon-cache.py --debug start
worker_processes 1;
user nobody nogroup;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log;
events {
worker_connections 64;
}
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
var RTBkit = require('./build/x86_64/bin/rtb.node');
var services = require('./build/x86_64/bin/services.node');
var zookeeperUri = "localhost:2181"; // must point to same Zookeeper as routers
var services = new services.ServiceProxies();
services.useZookeeper(zookeeperUri);
services.logToCarbon('localhost:2003');
var agent = new RTBkit.BiddingAgent("myAgent", services);
# graphite-web install is hardcoded in setup.cfg to /opt/graphite
sudo mkdir /opt/graphite
sudo chown brad.users /opt/graphite
# run under python2.7 virtualenv
virtualenv --python=python2.7 ~/ve/graphite
source ~/ve/graphite/bin/activate
# install the necessary python packages (simplejson is for flot graphs)
pip install graphite-web carbon whisper django django-tagging uwsgi simplejson
- (void)fillProfile
{
RevMobAds *revmob = [RevMobAds session];
[[FBRequest requestForGraphPath:@"me?fields=id,gender,age_range,birthday"] startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error == nil) {
NSString *gender = [result objectForKey:@"gender"];
if (gender != nil)
revmob.userGender = [gender isEqualToString:@"male"] ? RevMobUserGenderMale : RevMobUserGenderFemale;
NSNumber *minAge = [[result objectForKey:@"age_range"] objectForKey:@"min"];
<?php
function gs_adreq($adreq) {
// Required variable checking
if(! array_key_exists('site_id', $adreq) ||
! array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
return 'no site id or user agent';
}
/** Class: Strophe.WebSocket
* XMPP Connection manager.
*
* Thie class is the main part of Strophe. It manages a BOSH connection
* to an XMPP server and dispatches events to the user callbacks as
* data arrives. It supports SASL PLAIN, SASL DIGEST-MD5, and legacy
* authentication.
*
* After creating a Strophe.Connection object, the user will typically
* call connect() with a user supplied callback to handle connection level
#import <RevMobAds/RevMobAds.h>
#import <RevMobAds/RevMobAdsDelegate.h>
@interface SampleAppViewController : UIViewController <RevMobAdsDelegate> {
}
@end
-- You may add this code in the main.lua file
require 'revmob'
local REVMOB_IDS = { ["Android"] = "Android App Id", ["iPhone OS"] = "IPhone OS App Id" }
RevMob.startSession(REVMOB_IDS)
local banner = RevMob.createBanner({x = display.contentWidth / 2, y = display.contentHeight - 20, width = 300, height = 40 })
-- You can also register listeners for Ad events:
revmobListener = function (event)