Skip to content

Instantly share code, notes, and snippets.

@nishadhka
nishadhka / nbgrep
Last active June 5, 2019 18:47 — forked from jbarratt/nbgrep
'nbgrep', search the code of all your ipython notebooks for version 3 and 4
#!/bin/bash
# usage: nbgrep 'pattern'
SEARCHPATH='/home/workingnotesBack'
# 'jq' technique lifted with gratitude
# from https://gist.github.com/mlgill/5c55253a3bc84a96addf
# Break on newlines instead of any whitespace
@nishadhka
nishadhka / workshop_Requirements.md
Last active December 25, 2018 15:26
Docker and Jupyter notebooks-Kovaipy-Workshop Requirements

Docker and Jupyter notebooks, portal to all Python environments

Background

Docker provides operating system level virtualisation. It eases the setting up, cloning and distribution of fully functional GUI less Linux operating system. In python programming, the setting of library and distribution can be difficult in many cases if the libraries are inherently depended on OS and low level languages. This become bottle neck in learning and experimenting with Python. Docker removes this barrier by file like virtual environments of fully functional OS.

The current workshop gives an hands on training on setting up docker for major operating systems. We will be using nested virtualisation in windows OS and native application for Linux OS’s. The docker setup and consuming various data science oriented docker containers will be looked upon. After setting up the docker, we will be discussing on Jupyter notebooks, a perfect GUI for docker headless server situation.

Objectives

  1. Introduce participants about the
@nishadhka
nishadhka / ml-Python-libraries.md
Last active October 15, 2019 12:55
Python machine learning libraries in docker

Machine learning libraries of Python in Docker

The docker tar.gz'd is 2.4 GB in size, download from here

background and installed libraries in the docker

  • to set up the new ubuntu docker image, it is 124MB in size,
    sudo docker search ubuntu
    sudo docker pull ubuntu
    
@nishadhka
nishadhka / ushahidi_form_key.py
Created August 20, 2018 18:09
Ushahidi form to key mapper, using attributes API
import requests
import json
oauth_url = 'http://sample_ushahidinstance/platform/oauth/token'
oauth_d = {
"grant_type": "password",
"scope": "apikeys posts country_codes media forms api tags savedsearches sets users stats layers config messages notifications webhooks contacts roles permissions csv tos dataproviders",
"client_id": "ushahidiui",
"client_secret": "35e7f0bca957836d05ca0492211b0ac707671261",
@nishadhka
nishadhka / Ushahidi_API_use_cases.ipynb
Last active August 23, 2018 04:49
usefull_tools/Ushahidi_API_use_cases.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nishadhka
nishadhka / ndvi_gee_shapefile.py
Created August 25, 2018 04:38
NDVI shape file creator from Landsat images, using Google earth engine and Python API
import numpy as np
import fiona
from shapely import geometry
import ee
ee.Initialize()
from gee_library import *
from rasterio.features import shapes
import geopandas as gp
import ntpath
import glob
@nishadhka
nishadhka / Jupyterhub_install.ipynb
Last active September 15, 2018 23:07
Jupyterhub_install.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nishadhka
nishadhka / .vimrc
Created November 8, 2019 04:02
Config file for VIM with nerdtree
"Source https://github.com/j1z0/vim-config/blob/master/vimrc
"vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
"git interface
@nishadhka
nishadhka / vim_commands.md
Last active November 8, 2019 10:57
Handy vim commands

Handy vim commands

  1. To save :w
  2. to quit :q
  3. to start nerdtree :NERDTREE
  4. to move in nerdtree :ctrl+w
  5. to close a file :ctrl+w+q
  6. to select multple lines :v
  7. to cut :d
  8. to copy :y
@nishadhka
nishadhka / Pyspark_to_extract_OSM_PBF_and_convert.md
Last active January 11, 2020 08:56
Pyspark to extract OSM PBF and convert into shape file
  1. based on this to convert the pbf into paraquet file
  2. The library, https://github.com/adrianulbona/osm-parquetizer to convert the osm.pbf file into three paraquet files
java -jar target/osm-parquetizer-1.0.1-SNAPSHOT.jar ../test1/romania-latest.osm.pbf
  1. The Python pyspark code to read the paraquete file and make subset on extent and save the shape file
  2. Using the docker for https://hub.docker.com/r/airpollutionstudyindia/matplotlib and executing the code in the contianer
from pyspark.sql import SparkSession
from pyspark.sql.functions import col,explode