Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
| # rootใฆใผใถใธๅใๆฟใ | |
| sudo su - | |
| # wgetใคใณในใใผใซ | |
| yum -y install wget | |
| # repositoryๅๅพ | |
| wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/e/ | |
| # repository่จญๅฎ | |
| rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-*.rpm | |
| # redisใคใณในใใผใซ |
| Below are the Big O performance of common functions of different Java Collections. | |
| List | Add | Remove | Get | Contains | Next | Data Structure | |
| ---------------------|------|--------|------|----------|------|--------------- | |
| ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array | |
| LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List | |
| CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array |
| #!/bin/bash | |
| # Following the guide found at this page | |
| # http://programmingarehard.com/2014/03/17/behat-and-selenium-in-vagrant.html | |
| echo "\r\nUpdating system ...\r\n" | |
| sudo apt-get update | |
| # Create folder to place selenium in |
This Gist assumes you already followed the instructions to install Cassandra, created a keyspace and table, and added some data.
brew install apache-spark
| // XPath CheatSheet | |
| // To test XPath in your Chrome Debugger: $x('/html/body') | |
| // http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
| // 0. XPath Examples. | |
| // More: http://xpath.alephzarro.com/content/cheatsheet.html | |
| '//hr[@class="edge" and position()=1]' // every first hr of 'edge' class |
| from random import choice | |
| from scrapy import signals | |
| from scrapy.exceptions import NotConfigured | |
| class RotateUserAgentMiddleware(object): | |
| """Rotate user-agent for each request.""" | |
| def __init__(self, user_agents): | |
| self.enabled = False | |
| self.user_agents = user_agents |
| #!/usr/bin/env python | |
| #! -*- coding: utf-8 -*- | |
| def build_graph(filename): | |
| graph = dict() | |
| with open(filename, 'r') as f: | |
| for line in f: | |
| s,t = line.split() | |
| s,t = int(s), int(t) | |
| dest_nodes = graph.get(s, set()) |
| #!/bin/bash | |
| # | |
| # Bash script to setup headless Selenium (uses Xvfb and Chrome) | |
| # (Tested on Ubuntu 12.04) trying on ubuntu server 14.04 | |
| # Add Google Chrome's repo to sources.list | |
| echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list | |
| # Install Google's public key used for signing packages (e.g. Chrome) | |
| # (Source: http://www.google.com/linuxrepositories/) |