Setup:
Samsung Galaxy Tab S5e SM-T720
Android Pie on Linux 4.9.112 (not rooted)
Termux
#!/usr/bin/env python | |
# secret-key | |
# Generate an app secret key | |
from base64 import b64encode | |
from os import urandom | |
random_bytes = urandom(64) | |
token = b64encode(random_bytes).decode() |
# Clone github repository setup | |
# import join used to join ROOT path and MY_GOOGLE_DRIVE_PATH | |
from os.path import join | |
# path to your project on Google Drive | |
MY_GOOGLE_DRIVE_PATH = 'My Drive/MyDrive/Udacity/deep-learning-v2-pytorch' | |
# replace with your Github username | |
GIT_USERNAME = "vsay01" | |
# definitely replace with your | |
GIT_TOKEN = "{YOUR_GITHUB_TOKEN}" |
#!/usr/bin/env python | |
from fiona.transform import transform_geom | |
from rasterstats import point_query | |
import mercantile | |
def make_dem_url(lon: float, lat: float, z: int = 14) -> str: | |
"""Returns a URL referencing the GeoTiff Digitial Elevation Model (DEM) | |
for the given point at a zoom level (default, max is 14). |
# pip install --user numba | |
from numba import jit, cuda | |
import numpy as np | |
# to measure exec time | |
from timeit import default_timer as timer | |
# normal function to run on cpu | |
def func(a): | |
for i in range(10000000): |
-- Get Max ID from table | |
SELECT MAX(id) FROM table; | |
-- Get Next ID from table | |
SELECT nextval('table_id_seq'); | |
-- Set Next ID Value to MAX ID | |
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)); |
In needed include base64 encoded simple image into HTML page in two formats:
1st as PNG format has length 196 characters and looks like this:
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAWElEQVR42mNkwA/qgbgRnwJGAgb8BwI7RkbGw5QYUAs0oGXUAPwGgKKqgYF0ANLTyAi1xhZI2WOYzsjYDJTbC2QewGHIwcERBsPcgHqgAX8pMQAcxfhyIwATTkxL+hgX2QAAAABJRU5ErkJggg==
2nd as CUR format has length 1536 characters and looks like this:
`AAACAAEAEBAAAAcABwBoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///z0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH////98AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////3wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////98AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
# install chromium, its driver, and selenium | |
!apt update | |
!apt install libu2f-udev libvulkan1 | |
!wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
!dpkg -i google-chrome-stable_current_amd64.deb | |
!wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/118.0.5993.70/linux64/chromedriver-linux64.zip | |
!unzip -j chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/ | |
!pip install selenium chromedriver_autoinstaller | |
# set options to be headless, .. |
Image download from ftp --> upload to AWS s3 bucket
Pull to AWS EC2 machine. Save off SWIR band ratios as tif with appropriate contrast. The SWIR data is an 8-band image. You need to first grab onnly the bands you need for visualization (8-3-1 or 6-3-1 make good combos)
import rasterio
import numpy as np
raster='18NOV09185526-A2AS-058669488010_01_P001.TIF'. #your file