This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFileExtension(filename){ | |
let ext = /^.+\.([^.]+)$/.exec(filename) | |
return ext == null ? '' : ext[1].length < 5 ? ext[1] : ''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CRON starting with cron.py script and it run via tmux demon tool or other. | |
For example in tmux | |
$ sudo apt install tmux | |
$ tmux new-session -s parser | |
$ source ./venv/bin/activate | |
$ python cron.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
posts = [ | |
{'name': 'Name 1', 'text': 'Some text 1'}, | |
{'name': 'Name 2', 'text': 'Some text 2'}, | |
{'name': 'Name 3', 'text': 'Some text 3'}, | |
{'name': 'Name 4', 'text': 'Some text 4'} | |
] | |
posts_text = [] | |
posts_text = list(map(lambda p: p['text'], posts)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import datefinder | |
def find_date(text): | |
matches = datefinder.find_dates(text, source=True) | |
detect_dates=[] | |
for match in matches: | |
year = match[0].year | |
if year > 2010 and year <= datetime.datetime.now().year: | |
detect_dates.append(match) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support import expected_conditions as EC | |
from bs4 import BeautifulSoup | |
#from fake_useragent import UserAgent | |
import datetime | |
import os | |
import platform | |
from selenium.common.exceptions import NoSuchElementException, TimeoutException |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def get_code(text, length = 8): | |
pattern= r"\D(\d{%d})\D" % length | |
code = re.findall(pattern, text) | |
return code[0] | |
mail_text = ''' | |
==================================================================================================== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tag used for the ghost docker image | |
export GHOST_IMAGE_TAG=latest | |
# Tag used for the MariaDB docker image | |
export MARIADB_IMAGE_TAG=latest | |
# Configure the blog url in ghost | |
export BLOG_URL=http://127.0.0.1:8022 | |
# Root password used for MariaDB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyproj | |
def get_lat_lng(x, y): | |
#x = 174055.2462 | |
#y = 614374.1559 | |
''' | |
ISRAEL GEO METADATA get from https://www.expertgps.com/convert-coordinates/ | |
hddd.ddddd° (Lat/Lon Degrees) | |
hddd° mm.mmm' (Lat/Lon Degrees & Minutes) | |
hddd° mm' ss.s" (Lat/Lon Deg. Min. Sec.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def insert_cities(cities): | |
dbname, tablename = 'MyDB', 'city_coordinates' | |
with connections[dbname].cursor() as cursor: | |
for city in cities: | |
cursor.execute(f""" | |
INSERT INTO {tablename} (record_id, X, Y, record_id_2, city_id, city_name_heb, secondary_id, city_type_id, city_type_name, cuty_name_eng) | |
VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", | |
(city['record_id'], city['X'], city['Y'], city['record_id_2'], city['city_id'], city['city_name_heb'], city['secondary_id'], city['city_type_id'], city['city_type_name'], city['city_name_eng'])) | |
connections[dbname].commit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<esri:Workspace xmlns:esri="http://www.esri.com/schemas/ArcGIS/9.3" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |
<WorkspaceDefinition xsi:type="esri:WorkspaceDefinition"> | |
... | |
</WorkspaceDefinition> | |
<WorkspaceData xsi:type="esri:WorkspaceData"> | |
<DatasetData xsi:type="esri:TableData"> | |
<DatasetName>city</DatasetName> | |
<DatasetType>esriDTFeatureClass</DatasetType> |