- Bash (AKA Bourne Again Shell) is a type of interpreter that processes shell commands.
- A shell interpreter takes commands in plain text format and calls Operating System services to do something.
- Bash is the improved version of Sh (Bourne Shell).
- A shell scripting is writing a program for the shell to execute and a shell script is a file or program that shell will execute.
- Terminal is the interface to the shell interpreter.
- A shell script is a fully-fledged programming language in itself. It can define variables, functions and we can do conditional execution of shell commands as well.
This file contains 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
# Execute Colab notebook on local Jupyter Runtime - https://research.google.com/colaboratory/local-runtimes.html | |
# Mount Google drive to collab notebooks to use files and folders into the notebook | |
# Ref : https://towardsdatascience.com/getting-started-with-google-colab-f2fff97f594c | |
from google.colab import drive | |
drive.mount('/content/gdrive') |
This file contains 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
-> Markdown => Simple Markup language | |
-> Colab's MD => Rendered via marked.js and similar to those in Jupyter and Github's version | |
-> Difference: Supports Latex equations(MathJax) like Jupyter but not HTML tags | |
-> Syntax Highlighting in the code blocks | |
****************HEADINGS************** | |
# This is equivalent to an <h1> tag | |
##### This is equivalent to an <h5> tag | |
_A text in italics_ ; __A text in bold__ ; ~~strike-through text~~ |
This file contains 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
# Ref - https://colab.research.google.com/notebooks/widgets.ipynb | |
# Build and control layout dynamically through code | |
from google.colab import widgets | |
# ----GRIDS----- | |
grid = widgets.Grid(2, 2, header_row=True, header_column=True) # Grid object | |
# Grid.output_to(indices) to direct output stream to that place in the grid. | |
with grid.output_to(1, 1): |
This file contains 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
# Ref -> https://colab.research.google.com/notebooks/io.ipynb#scrollTo=BaCkyg5CV5jF | |
# ---------- UPLOAD FROM LOCAL FILE SYSTEM -------------------- | |
# files.upload returns a dictionary of the files which were uploaded. The dictionary is keyed by the file name, the value is the data which was uploaded. | |
# files.download will invoke a browser download of the file to the user's local computer. |
This file contains 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
# load the iris dataset | |
from sklearn.datasets import load_iris | |
iris = load_iris() | |
# store the feature matrix (X) and response vector (y) | |
X = iris.data | |
y = iris.target | |
# splitting X and y into training and testing sets |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
This file contains 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
=== Use conda environment to run a python script === | |
SHELL=/bin/bash | |
CONDA_PREFIX=/home/code/packages/miniconda3 | |
CONDA_INIT="/home/code/packages/miniconda3/etc/conda/activate.d/proj4-activate.sh" | |
PYTHON=/home/code/packages/miniconda3/bin/python | |
12 13 * * * . $CONDA_INIT ; $PYTHON <python file> | |
=== Use date utility for naming a log file === | |
DATEVAR="date +%Y%m%d_%H%M" | |
17 * * * * echo "logs_$($DATEVAR).txt" |
This file contains 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
======================= | |
FLASK module -> | |
from flask import Flask, g, request, redirect, url_for | |
======================= |
OlderNewer