Skip to content

Instantly share code, notes, and snippets.

@hskrishna29
hskrishna29 / pivotmultiplecolumns.sql
Created March 6, 2017 19:30
SQL Pivot on multiple aggregated columns
DROP TABLE TempFacts
CREATE TABLE TempFacts (
Model NVARCHAR(100)
,DATE DATETIME
,Engine NVARCHAR(100)
,Revenue DECIMAL(18, 6)
,Conversions DECIMAL(18, 6)
)
@jaceklaskowski
jaceklaskowski / deployment-tool-ansible-puppet-chef-salt.md
Last active January 3, 2024 22:12
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@benmj
benmj / geocoder-service.js
Created August 29, 2013 16:38
An AngularJS Service for intelligently geocoding addresses using Google's API. Makes use of localStorage (via the ngStorage package) to avoid unnecessary trips to the server. Queries Google's API synchronously to avoid `google.maps.GeocoderStatus.OVER_QUERY_LIMIT`
/*global angular: true, google: true, _ : true */
'use strict';
angular.module('geocoder', ['ngStorage']).factory('Geocoder', function ($localStorage, $q, $timeout) {
var locations = $localStorage.locations ? JSON.parse($localStorage.locations) : {};
var queue = [];
// Amount of time (in milliseconds) to pause between each trip to the
@shrugs
shrugs / TwitterHappy.py
Created October 13, 2012 04:59
Percentage of Happy Twitter Users
import tweepy
import matplotlib.pyplot as plt
from time import time
#number of statuses logged
status_count = 0
#set up auth
auth1 = tweepy.auth.OAuthHandler('Consumer Key','Consumer Secret')
auth1.set_access_token('Auth Key','Auth Secret')