Skip to content

Instantly share code, notes, and snippets.

View Zia-'s full-sized avatar
๐Ÿ™
I might be slow in response.

Mohammed Zia Zia-

๐Ÿ™
I might be slow in response.
View GitHub Profile
@Zia-
Zia- / Terminal Commands
Last active May 15, 2017 07:48
Terminal Commands useful on a daily basis
1. Trim terminal path:
PS1='\u:\W\$ '
OR
PS1='\W\$ '
2. Go to previous directory:
cd -
3. Kill Port process and free it:
sudo lsof -i :3000
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>point_bank</Name>
<UserStyle>
<Title>bank point style</Title>
-- The following should be OK
select pgr_labelGraph('ways');
select pgr_labelGraph('Ways');
select pgr_labelGraph('ways', 'id');
select pgr_labelGraph('ways', 'id', 'source');
select pgr_labelGraph('ways', 'id', 'source', 'target');
select pgr_labelGraph('ways', 'id', 'source', 'target', 'subgraph');
select pgr_labelGraph('ways', 'id', 'source', 'target', 'subgraph', 'id<100');
"======== Custom Mapping ========
"general mapping
nmap <C-Tab> :tabnext<CR>
nmap <C-S-Tab> :tabprevious<CR>
map <C-S-Tab> :tabprevious<CR>
map <C-Tab> :tabnext<CR>
imap <C-S-Tab> <ESC> : tabprevious<CR>
imap <C-Tab> <ESC> : tabnext<CR>
noremap <F7> :set expandtab!<CR>
import osgeo.ogr
shapefile = osgeo.ogr.Open("/Users/zia/Documents/journals/My_WriteUp/pgr_TPP_5Algos/data/citySelection/majorCountriesCityShapefile/selectedworldcityshapes.shp")
layer = shapefile.GetLayer(0)
f = open("/Users/zia/Documents/journals/My_WriteUp/pgr_TPP_5Algos/data/citySelection/testCode/osmCityDownloadLinks.txt", 'w')
for i in range(layer.GetFeatureCount()):
feature = layer.GetFeature(i)
import os
from xml.dom import minidom
proj_dir = "/Users/zia/Documents/journals/My_WriteUp/Terrain_Routing_New/osm_data_downloaded/singaporeMalaysia/numberOfNodesPerRoad"
rel_file_path = "osm.osm";
abs_file_path = os.path.join(proj_dir, rel_file_path)
result_rel_file_path = "numberOfNodesPerRoad.csv"
result_abs_file_path = os.path.join(proj_dir, result_rel_file_path)
import os, time, csv, json
modisc6GlobalUrl = "modis c6 global csv url"
basePath = 'modis c6 basepath to 194 server'
baseFileName = 'modis c6 data base filename'
def createElemGeojson(latitude,longitude,brightness,scan,track,acq_date,acq_time,satellite,confidence,version,bright_t31,frp,daynight):
propValue = {}
propValue['BRIGHTNESS'] = float(brightness)
propValue['SCAN'] = float(scan)
from ftplib import FTP
import datetime, os, h5py, json
import matplotlib.pyplot as plt
import numpy as np
ftpUrl = 'ftp url'
user = 'username'
passwd = 'password'
basePath = 'seviri lsa path in 194 server'
baseFileName = 'name of seviri list product'
1. # Open cron command
sudo crontab -e
2. # Paste the following line at the very end to execute above script after every 5 min.
# More details about this at http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
*/5 * * * * /usr/bin/python2.7 /var/www/html/maps/firemap/realdata-geojson/viirs/pullViirsData.py
3. # That's it. It will even run on system reboot.