ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"brew update| <?php | |
| function hierarchical_array_from_array($farray){ | |
| foreach ($flatArray as $key=>$flat) { | |
| $nodes = array(); | |
| $tree = array(); | |
| foreach ($flatArray as $key=>&$node) { | |
| $node["Children"] = array(); | |
| $id = $node["@id"]; | |
| $parent_id = $node["@parentId"]; | |
| $nodes[$id] =& $node; |
| - Knowing the ".info" files | |
| Tell drupal about your theme. | |
| - Playing with ".tpl.php" (Template) files | |
| Place for your all HTML structure. | |
| - Variables in ".tptl.php" files | |
| Dynamic bits of content which is to be printed in your template file. | |
| - Theme Functions overriding. |
| VARIABLE SET: | |
| drush vset --yes file_private_path <path-to-private-files> | drush vset --yes file_temporary_path <path-to-temporary-file> | | |
| NOT NEEDED ADMIN AND NEEDED ADMIN MENU | |
| drush dis admin -y | drush en admin_menu diff field_ui -y | |
| DRUSH KICKSTART | |
| drush dl [drupal-version] | |
| drush si --db-url=mysql://[dbusername]:[dbpassword]@localhost/[dbname] | |
| drush upwd admin --password=[MyEasyDevPassword] |
| # Importing a db with multiple bson files | |
| # Note each bson is a collection. | |
| mongorestore -d db_name path/ | |
| # To start db use: | |
| mongo db_name | |
| # To see collections use: | |
| show collections |
| pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
| # Command pipeline | |
| # Non hadoop way using only linux commands. | |
| cat data | map | sort | reduce | |
| # some text to mapper. | |
| echo "foo foo quux labs foo bar quux" | <dirto/>mapper.py | |
| # Some text to mapper then sort and then reducer. | |
| echo "foo foo quux labs foo bar quux" | <dirto/>mapper.py | sort-K1, 1 | <dirto/>reducer.py | |
| # Doing with file. | |
| cat myfilename.txt | <dirto/>mapper.py | sort-K1, 1 | <dirto/>reducer.py |
| # Find the number of line in a file type recuresively. | |
| find . -name '*.php' | xargs wc -l | |
| # Find occurence on on word say "carrot" in many files. | |
| grep -ir carrot . | wc -l | |
| # This helps in moving files so keep backup!!! | |
| # Moves files with json extension from sub-folders recursively to single output folder. | |
| find <parent/folders/subfolders> -type f -name '*.json' -exec mv -i {} <new/folder> \; |
| # -*- coding: utf-8 -*- | |
| import json | |
| import re | |
| import os | |
| import nltk | |
| input_file = open('<JSON FILE To INPUT>','r').readlines() | |
| for line in input_file: | |
| try: | |
| tweet = json.loads(line) |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # Parts of this code have be taken from Dr.Calix's ITS520 Class at Purdue University. | |
| # Co-Authored: Ravish Gupta | |
| ########################################################## | |
| import csv | |
| import warnings | |
| import matplotlib.pyplot as plt | |
| import tensorflow as tf | |
| import numpy as np |