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
| import csv | |
| from collections import deque | |
| with open('weekly_stock_trends.csv', 'rb') as f: | |
| reader = csv.reader(f) | |
| weekly_trends = list(reader) | |
| headers = weekly_trends.pop(0) | |
| new_headers = [] |
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
| SPARK_CLASSPATH=../mysql-connector-java-5.1.35/mysql-connector-java-5.1.35-bin.jar bin/spark-shell | |
| val jdbcDF = sqlContext.load("jdbc", Map( | |
| "url" -> "jdbc:mysql://localhost:8889/employees?user=root&password=root", | |
| "dbtable" -> "(SELECT employees.*, departments.*, salaries.salary, titles.title FROM employees JOIN dept_emp ON dept_emp.emp_no = employees.emp_no JOIN departments ON departments.dept_no = dept_emp.dept_no JOIN dept_manager ON dept_manager.emp_no = employees.emp_no JOIN salaries ON salaries.emp_no = employees.emp_no JOIN titles ON employees.emp_no = titles.emp_no) AS employees", | |
| "driver" -> "com.mysql.jdbc.Driver", | |
| "partitionColumn" -> "emp_no", | |
| "lowerBound" -> "10001", | |
| "upperBound" -> "499999", | |
| "numPartitions" -> "10" |
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
| if [ "$(git diff --name-only master --diff-filter=AMR | grep -Ei "^.*app\/(models|controllers)\/.*\.php$")" ]; then vendor/bin/phpcs $(git diff --name-only master --diff-filter=AMR | grep -Ei "^.*app\/(models|controllers)\/.*\.php$") --standard=PSR2; fi |
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
| # Check for Homebrew, | |
| # Install if we don't have it | |
| if test ! $(which brew); then | |
| echo "Installing homebrew..." | |
| ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| fi | |
| # Update homebrew recipes | |
| brew update |
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 ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/subl |
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
| class ApplicationController < ActionController::Base | |
| protect_from_forgery | |
| before_filter :cor | |
| def cor | |
| headers["Access-Control-Allow-Origin"] = "http://localhost:8000" | |
| headers["Access-Control-Allow-Methods"] = %w{GET POST PUT DELETE}.join(",") | |
| headers["Access-Control-Allow-Headers"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(",") | |
| head(:ok) if request.request_method == "OPTIONS" | |
| end |
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
| $ ps aux | grep mysql | |
| $ sudo kill -9 629 513 #1, 5, 9 (varying levels of process killing) |
NewerOlder