This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install --assume-yes python-software-properties | |
sudo apt-add-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install --assume-yes nodejs | |
sudo apt-get install --assume-yes git | |
# Install Graphite | |
sudo apt-get install python-dev ruby-dev bundler build-essential libpcre3-dev graphite-carbon graphite-web | |
cat >> /tmp/graphite-carbon << EOF | |
# Change to true, to enable carbon-cache on boot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From: http://www.cyberciti.biz/tips/using-nginx-as-reverse-proxy.html | |
# and: http://www.cyberciti.biz/faq/howto-linux-unix-setup-nginx-ssl-proxy/ | |
# and: http://nginx.org/en/docs/http/websocket.html | |
# Run the following commands as su | |
sudo -s | |
# Use the stable version of nginx | |
nginx=stable | |
# Add nginx repository source | |
add-apt-repository ppa:nginx/$nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add to /opt/graphite/webapp/graphite/render/functions.py (Around the "def movingAverage(" line): | |
def historicalAverage(requestContext, seriesLists, points=7, offset=86400, highPassCount=1, lowPassCount=1): | |
historicalLists = [] | |
for series in seriesLists: | |
hlist = [] | |
for i in range(1,points+1): | |
tShift = str(offset * i) + "s" | |
shiftedSeries = timeShift(requestContext, [series], tShift) | |
hlist.append(shiftedSeries[0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System.Text.RegularExpressions; | |
namespace AndroidAutoIncrementVersion | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
try |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################################### | |
# BASIC REQUIREMENTS | |
# http://graphite.wikidot.com/installation | |
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/ | |
# Last tested & updated 10/13/2011 | |
#################################### | |
cd | |
sudo apt-get update | |
sudo apt-get upgrade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
using MvcKickstart.Infrastructure; | |
using StructureMap; | |
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(YourProject.IocConfig), "PreStart", Order = -100)] | |
// This gets installed automatically with the MvcKickstart nuget (https://nuget.org/packages/mvckickstart) | |
namespace YourProject | |
{ | |
public static class IocConfig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Microsoft.Practices.ServiceLocation; | |
using StructureMap; | |
// This is part of MvcKickstart (https://nuget.org/packages/mvckickstart) | |
namespace MvcKickstart.Infrastructure | |
{ | |
/// <summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var topPages = new DataQuery(settings.SiteId, from, to) | |
{ | |
Metrics = "ga:pageviews", | |
Dimensions = "ga:pagePath,ga:pageTitle", | |
Sort = "-ga:pageviews", | |
NumberToRetrieve = 20 | |
}; | |
foreach (DataEntry entry in analytics.Query(topPages).Entries) | |
{ | |
var value = entry.Metrics.First().IntegerValue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var siteUsage = new DataQuery(settings.SiteId, from, to) | |
{ | |
Metrics = "ga:visits,ga:pageviews,ga:percentNewVisits,ga:avgTimeOnSite,ga:entranceBounceRate,ga:exitRate,ga:pageviewsPerVisit,ga:avgPageLoadTime" | |
}; | |
var siteUsageResult = (DataEntry)analytics.Query(siteUsage).Entries.FirstOrDefault(); | |
if (siteUsageResult != null) | |
{ | |
foreach (var metric in siteUsageResult.Metrics) | |
{ | |
switch (metric.Name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var authFactory = new GAuthSubRequestFactory("analytics", ApplicationName) | |
{ | |
Token = settings.SessionToken | |
}; | |
var analytics = new AnalyticsService(authFactory.ApplicationName) { RequestFactory = authFactory }; | |
foreach (AccountEntry entry in analytics.Query(new AccountQuery()).Entries) | |
{ | |
var account = entry.Properties.First(x => x.Name == "ga:accountName").Value; | |
if (!model.Sites.ContainsKey(account)) |
NewerOlder