Skip to content

Instantly share code, notes, and snippets.

View optimistanoop's full-sized avatar
💭
<tod-fod-code>

Anoop Kumar optimistanoop

💭
<tod-fod-code>
View GitHub Profile
@optimistanoop
optimistanoop / app.js
Created April 25, 2018 07:40
web form validator.
function trim(str) {
str = str.replace(/\s+/g, ' ');
str = str.replace(/^\s|\s$/g, '');
return str;
}
function isValidPassword(str) {
let returnValue = false;
// check for null string
@optimistanoop
optimistanoop / app.md
Last active April 24, 2018 12:49
running node on android.

Download and install the Termux android application from google playstore. The system requirement for installing it is Android version 5.0+. Open the Termux app. It will show you a Command Line Interface. Type these commands:

  • First check it for updates and upgrades:

    $ apt update && apt upgrade
    
  • Termux comes with minimal base system, so consider installing coreutils for full fledged commands of CLI:

@optimistanoop
optimistanoop / app.MD
Created April 17, 2018 12:58
my bash profile
### Aliases

# Open specified files in Sublime Text
# "s ." will open the current directory in Sublime
# alias s='open -a /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# Color LS
colorflag="-G"

alias ls="ls ${colorflag}"

Bash Keyboard Shortcuts

Mon Dec 29 19:53:08 PST 2014 Link

Moving the cursor:

Keys Description
Ctrl + a Go to the beginning of the line (Home)
@optimistanoop
optimistanoop / gist:07611afa1eed0d7cf4bd0fd1e6052f09
Created March 10, 2018 08:25
Simple Google Apps Script to export a single sheet to PDF and email it to a contact list
// Simple function to send Weekly Status Sheets to contacts listed on the "Contacts" sheet in the MPD.
// Load a menu item called "Project Admin" with a submenu item called "Send Status"
// Running this, sends the currently open sheet, as a PDF attachment
function onOpen() {
var submenu = [{name:"Send Status", functionName:"exportSomeSheets"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu('Project Admin', submenu);
}
function exportSomeSheets() {
@optimistanoop
optimistanoop / app.md
Last active March 12, 2021 16:27
tmux terminal

Tmux

Tmux is a terminal multiplexer. It allows you to run and manage several command prompts simultaneously from one tmux session. It is the equivalent of a graphical window manager, for command prompts.

Install tmux

sudo apt-get update && sudo apt-get -y install tmux

sudo apt-get install tmux

Common session commands

@optimistanoop
optimistanoop / app.md
Last active May 25, 2017 10:46
PAP Helper Prototyping - In dev
var state = this.state;
var config = this.state.CONFIG;
var deafultConf = this.state.CONFIG[0];
// Form 
// validation
// post
// page -2
// payment
@optimistanoop
optimistanoop / HashTable.md
Created May 24, 2017 08:48
HashTable Implimentation in Js

Introduction

  • Hash tables provide fast insertion, deletion, and retrieval.
  • Hash tables perform poorly for searching, eg- finding the minimum and maximum values in a data set.
  • For searching, finding the minimum and maximum values, binary search tree is more appropriate.

An Overview of Hashing

  • The hash table data structure is designed around an array.
  • Each data element is stored in the array based on an associated data element called the key (generated by hash function).
@optimistanoop
optimistanoop / app.md
Last active May 6, 2017 11:10
Deep learning commands

install tensorflow for python 3 (linux)

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp36-cp36m-linux_x86_64.whl

install tensorflow for python 3 (mac)

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.1-py3-none-any.whl

conda command not found

export PATH=~/anaconda3/bin:$PATH