Skip to content

Instantly share code, notes, and snippets.

View pratos's full-sized avatar
🎯
Focusing

prthamesh pratos

🎯
Focusing
View GitHub Profile
@pratos
pratos / commands.md
Created May 5, 2017 14:40
Google Cloud Platform Commands
  • Command to authenticate glcoud

    • gcloud auth login
  • Command to chose an existing project

    • gcloud project list
    • gcloud config set core/project <project-name>
  • Command to create and choose a new project *

@pratos
pratos / nb.md
Created May 10, 2017 10:36
Run remote jupyter notebook

Run the notebook in the server (remote) * jupyter notebook --no-browser

Run the ssh in the local shell

  • ssh -N -f -L localhost:8888:localhost: user@ip
@pratos
pratos / zip2csv.md
Created June 9, 2017 06:02
Converting list of lists/zip(list) to a CSV

Converting list of lists/zip(list) to a CSV

kaggle_submission = zip(image_id, label_predict, predictions)
    
    with open("kaggle_submission.csv", "w") as f:
        fileWriter = csv.writer(f, dialect='excel')
        for img_id, pred, label in kaggle_submission:
            row = [img_id, pred, label]
 print(row)
@pratos
pratos / docker.md
Last active July 18, 2017 11:53
Using docker with Microsoft Azure

Creating docker application from local system using Docker CLI

  • To create a machine using Docker CLI:
    • docker-machine create --driver azure --azure-subscription-id <subs-id> --azure-location <location:eg. eastus> --azure-resource-group <resource-group-name if created/otherwise created automatically> --azure-size <vm-name> <machine-name>

NOTE: Every Resource group has upto 10 CPU Core limit, so if you get issues creating newer instances solution is to create a new resource group.

VM Sizes:

@pratos
pratos / mount.md
Created September 9, 2017 12:22
Mount EBS to EC2 instances
lsblk
sudo file -s /dev/xvdf
sudo file -s /dev/xvda1
sudo mkfs -t ext4 /dev/xvdf
sudo mkdir datasets
sudo mount /dev/xvdf datasets 

ls
cd datasets/

How Do I Into Git?

a helpful primer for users sick of git's poorly-named commands

I've used Git since 2011, and this is the stuff that I've always had to Google to remember. I hope it helps you not hate Git so much.

Learning About the Repo

Learning About History

@pratos
pratos / README.md
Created September 11, 2017 13:29 — forked from dannguyen/README.md
Using Python 3.x and Google Cloud Vision API to OCR scanned documents to extract structured data

Using Python 3 + Google Cloud Vision API's OCR to extract text from photos and scanned documents

Just a quickie test in Python 3 (using Requests) to see if Google Cloud Vision can be used to effectively OCR a scanned data table and preserve its structure, in the way that products such as ABBYY FineReader can OCR an image and provide Excel-ready output.

The short answer: No. While Cloud Vision provides bounding polygon coordinates in its output, it doesn't provide it at the word or region level, which would be needed to then calculate the data delimiters.

On the other hand, the OCR quality is pretty good, if you just need to identify text anywhere in an image, without regards to its physical coordinates. I've included two examples:

####### 1. A low-resolution photo of road signs

@pratos
pratos / ssh.md
Last active September 12, 2017 07:14
Controlling the contributions from separate workstation
  • Generate ssh keys:
    • ssh-keygen -t rsa -C "<emai-id>@gmail.com"
  • Add them, delete the previous ones:
    • ssh-add ~/.ssh/id_rsa_prato_git
    • ssh-add -D
    • ssh-add -l
  • Change the config file:
    • vim config
    • Add below:
@pratos
pratos / git.md
Last active September 19, 2017 11:56
Git Common - AthenaSight

General git commands_

git clone <git-clone repository link>
------------or----------------------
git remote add origin https://github.com/user/repo.git

git add <folder/filename>
git commit -m "Comment"
git status
@pratos
pratos / logs.md
Created October 22, 2017 20:06
Docker image creation logs
•100% ➜ docker build -t tensorflow-av .
Sending build context to Docker daemon  3.584kB
Step 1/6 : FROM python:3.6
 ---> 968120d8cbe8
Step 2/6 : RUN apt-get update
 ---> Running in 20271eafe0d0
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]