Skip to content

Instantly share code, notes, and snippets.

monthlyUserSignins
function main() {return join(Events({from_date: "<<fromDate>>",to_date: "<<toDate>>",event_selectors: [{event: "USER_SIGN_IN"}]}), People(), {type: "inner"}).map(function (result) {var date = new Date(result.event.time);var dd = (date.getDate() < 10 ? "0" : "") + date.getDate();var MM = ((date.getMonth() + 1) < 10 ? "0" : "") + (date.getMonth() + 1);var yyyy = date.getFullYear();return {"date": MM+"-"+dd+"-"+yyyy,"userId":result.user.properties["External ID"],"isDeepLinkSession":result.event.properties.isDeepLinkSession}}).groupBy(["userId"],mixpanel.reducer.count()).map(result => ({"userId": result.key[0],"count": result.value})).reduce(mixpanel.reducer.count())}
monthlyUserStarted
function main() {return join(Events({from_date: "2019-11-01",to_date: "2019-11-30",event_selectors: [{event: "WATCH_NAVIGATION"},{event: "UNDERSTAND_NAVIGATION"},{event: "PRACTICE_NAVIGATION"}]}), People(), {type: "inner"}).map(result => ({"eventName": result.event.name,"skillId": result.event.properties["Sk
web: bundle exec unicorn -p 3000 -c ./config/unicorn.rb
resque: env TERM_CHILD=1 COUNT=3 QUEUE=high,normal,low RESQUE_TERM_TIMEOUT=5 bundle exec rake resque:work
function flatten (arr) {
if (!Array.isArray(arr)) {
return arr
}
return arr.reduce((memo, elem) => {
if (Array.isArray(elem)) {
return memo.concat(flatten(elem))
} else {
return memo.concat(elem)
@javamonn
javamonn / gist:76dd276efcc814ff14c7
Last active September 3, 2015 23:21
Running Kubernetes locally with docker
docker run --net=host -d gcr.io/google_containers/etcd:2.0.9 /usr/local/bin/etcd --addr=127.0.0.1:4001 --bind-addr=0.0.0.0:4001 --data-dir=/var/etcd/data
docker run --net=host --privileged -d -v /var/run/docker.sock:/var/run/docker.sock gcr.io/google_containers/hyperkube:v0.21.2 /hyperkube kubelet --api_servers=http://localhost:8080 --v=2 --address=0.0.0.0 --enable_server --hostname_override=127.0.0.1 --config=/etc/kubernetes/manifests --containerized
docker run -d --net=host --privileged gcr.io/google_containers/hyperkube:v0.21.2 /hyperkube proxy --master=http://127.0.0.1:8080 --v=2
Differs from the docs at http://kubernetes.io/v1.0/docs/getting-started-guides/docker.html in that the kublet must be run with the
--privileged flag in order to mount volumes.
@javamonn
javamonn / gist:0a209ef6e2bd62fa7804
Created July 10, 2015 00:03
start postgresql server on mac
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@javamonn
javamonn / gist:1f443115b44d22ff1257
Created March 2, 2015 17:16
Dumping DB from MongoHQ
mongodump -h candidate.12.mongolayer.com:10054 -d *db name* -u *username* -p *password* -o *output-dir*
@javamonn
javamonn / gist:065f6cae35271091e27d
Created January 16, 2015 02:43
obscure SO answer that magically starts mysqld on osx yosemite
sudo /usr/local/mysql/support-files/mysql.server start
http://stackoverflow.com/questions/25700971/fatal-error-please-read-security-section-of-the-manual-to-find-out-how-to-run