Ad

Saturday, March 31, 2018

Command Line Essentials Cheat Sheet

  • echo $PATH
  • changing the $PATH to optimize for basic unix commands can help save time. Very important for server maintenance.
  • // print current working directory
    $pwd
  • grep -n showing line number
  • less slash search
    wc word count
  • If need to approximate find or remember a command:
    apropos keyword
     apropos copy
  • PHP Command line: error log (have to turn the error log on first)
  • >tail -100f error.log
  • Generally heroku and phonegap may require commandline tools, in heroku it is known as the heroku command line toolbelt
  • Show and hide hidden files on mac
 

MAKE HIDDEN FILES SHOW/HIDE IN MAC FINDER

Just follow the steps below and your finder will show hidden files:-

Start your “Terminal”
type “defaults write com.apple.finder AppleShowAllFiles TRUE” and enter (without the quote)
type “killall Finder” and enter (without quote)
Done. You have just enable your show hidden files in Finder
To disable the show hidden files in Finder, follow the steps below:-

Start your “Terminal”
type “defaults write com.apple.finder AppleShowAllFiles FALSE” and enter (without the quote)
type “killall Finder” and enter (without quote)
Done. You have just disable your show hidden files in Finder

Testing Toolbox

Selenium
Record clicks
insert blank line
s put an arrow on the line, play will handle it

JavaScript toolbox


  • Learn JavaScript for coding bootcamp graduates

  • Machine learning with JavaScript deep learn js with Tensorflow

  • Studying and teaching materials for JavaScript MVC
  • http://www.teaching-materials.org/jsmvc/
  • Learn the concept of JavaScript templates Knockout.js tutorial

Friday, March 30, 2018

Object Oriented Programming with Python

Define a Stack class, just the skeleton, illustrates how classes are implemented in Python. Lower case self, is the first argument to methods.

Class Stack:
def __init__(self):
pass
def is_empty(self):
pass
def push(self, value):
pass
def pop(self):
pass

Python toolbox


  • Scrapy for web scraping
  • Geopy for geographic data
  • SciPy for advanced science and mathematics formula
  • Numpy for linear algebra and matrix manipulation
  • Tensorflow for machine learning with CPU, GPU and in the cloud, with TPU
  • spaCy natural language processing NLP with python
  • control+cmd+g expand current word selection to all matching words.

Thursday, March 29, 2018

Handling Date and Time in Pandas

First of all need to convert DataFrame Series to datetime object. You can start by importing the datetime module.

import datetime

You can check the column data type of any Pandas DF columns

df['col_name'].dtype

It likely returns 'O' for object

In order to convert a column of type object to datetime use the pd.to_datetime function. You must also pass in a format specifying the year, month, day

df['col_name'] = pd.to_datetime(df['col_name'], format="%m/%d/%y")

This results in a datetime64 type column.

Formatting cheatsheet can be found here:
http://strftime.org/
For more advanced datetime formatting, also refer to the official document above

Pandas can sometimes infer or guess the datetime without receiving format instructions
use this flag below

df['my_col'] = pd.to_datetime(df['my_col'], infer_datetime_format=True)

Once converted to datetime, we can access year month day  data:
df['dt_parsed'].dt.day


Python Pandas Data Science Manipulation Pandas Cheat Sheet

pandas.Series = (
 {key : value}
)

pandas.DataFrame  = (
{key : value},
{key : value},
{key : value},
index=[]
)

Add new column
pandas.DataFrame['col_name'] = value

     value can be a series of vectors or dictionary
     pd.Series({0:'first', 1:'second'})



placeholder strategy
df['feedback'] = ['+', None, '-']

turn index into auto incrementing default numbers
guaranteed unique
df.reset_index()


join dataframes

Pandas data types http://pandas.pydata.org/pandas-docs/stable/basics.html#dtypes

df.to_csv() export dataframe as csv

data = pd.read_csv("data.csv", sep = '\t', nrows = nrows)

React UI, UI UX, Reactstrap React Bootstrap

React UI MATERIAL  Install yarn add @material-ui/icons Reactstrap FORMS. Controlled Forms. Uncontrolled Forms.  Columns, grid