Skip to content

Instantly share code, notes, and snippets.

// Desired unique index:
// db.categories.ensureIndex({ category_url: 1, category_page_url: 1 }, { unique: true})
db.categories.aggregate([
{ $group: {
_id: { category_url: "$category_url", category_page_url: "$category_page_url" },
uniqueIds: { $addToSet: "$_id" },
count: { $sum: 1 }
}},
{ $match: {

Tutorial: Meteor in Windows using Vagrant

BEFORE YOU CONTINUE:

  • Now, Meteor runs in any Windows without any line of this tutorial. Just download the Meteor binary! Yay!!
  • mrt is no longer used with Meteor 1.0

These days some people were discussing at meteor-talk group about running Meteor at Windows and I’ve recommended them using Vagrant. It’s a very developer-friendly piece of software that creates a virtual machine (VM) which let you run any operating system wanted and connect to it without big efforts of configuration (just make the initial installation and you have it working).

Many packages (I've tested) for running Meteor+Vagrant fails because Meteor writes its mongodb file and also other files inside local build folder into a shared folder between the Windows host and the Linux guest, and it simply does not work. So I've put my brain to work and found a solution: do symlinks inside the VM (but do not use ln. Use mount so git can follow it). It’s covered on

@zubairalam
zubairalam / python 3
Created July 13, 2015 19:41
Install python3 dependencies using virtualenv
sudo apt-get install python3-pip
virtualenv --no-site-packages --distribute -p /usr/bin/python3.3 ~/.virtualenvs/pywork3
@zubairalam
zubairalam / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@zubairalam
zubairalam / selenium_spider.py
Last active August 29, 2015 14:25 — forked from irfani/selenium_spider.py
Scrapyd with Selenium Spider
from selenium import selenium
from scrapy.spider import BaseSpider
from scrapy.http import Request
import time
import lxml.html
class SeleniumSprider(BaseSpider):
name = "selenium"
allowed_domains = ['selenium.com']
start_urls = ["http://localhost"]
sudo apt-get install python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev
pip install scrapy
import re
def print_match(match):
if match is None:
print 'No match'
return
print match.group()
return match
@zubairalam
zubairalam / RedisPythonPubSub1.py
Last active August 29, 2015 14:26 — forked from jobliz/RedisPythonPubSub1.py
A short script exploring Redis pubsub functions in Python
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
@zubairalam
zubairalam / LICENSE
Last active August 29, 2015 14:27 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@zubairalam
zubairalam / install-pip.py
Last active August 31, 2015 12:13 — forked from amacinho/install-pip.py
install pip
# install pip via apt-get
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip