View nginx.conf
This file contains 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
server { | |
listen 80; | |
server_name sb.domain.com; | |
return 301 https://sb.domain.com$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
server_name sb.domain.com; |
View gist:a06ed514c121c548205026b0b946bfa6
This file contains 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
bind 127.0.0.1 | |
protected-mode yes | |
port 6379 | |
tcp-backlog 65384 | |
unixsocket /tmp/redis_6379.sock | |
unixsocketperm 700 | |
timeout 0 | |
tcp-keepalive 300 | |
daemonize no | |
supervised no |
View gist:a7e75777b80571e6ef185cdb427b2bdb
This file contains 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
[Unit] | |
Description=Redis persistent key-value database | |
After=network.target | |
[Service] | |
ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf --daemonize no --supervised systemd | |
ExecStop=/usr/libexec/redis-shutdown | |
#Type=notify | |
User=redis | |
Group=redis |
View response_ig_user_media.dict
This file contains 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
{ | |
'data': [ | |
{ | |
'name': 'impressions', | |
'period': 'lifetime', | |
'values': [ | |
{ | |
'value': 13 | |
} | |
], |
View def_ig_media_insights.py
This file contains 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 requests | |
def get_url(instagram_media_id,instagram_token): | |
url = ""https://graph.facebook.com/v14.0/" + str(instagram_media_id) + "/insights?metric=impressions%2Cengagement%2Creach%2Csaved%2cvideo_views&access_token=" + str(instagram_token) | |
r = requests.get(url) | |
return r.json() |
View def_ig_media.py
This file contains 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 requests | |
def get_url(instagram_profile_id,instagram_token): | |
url = "https://graph.facebook.com/v14.0/"+str(instagram_profile_id)+"/media?fields=id%2Ccaption%2Cis_comment_enabled%2Ccomments_count%2Clike_count%2Cmedia_type%2Cmedia_url%2Cpermalink&access_token="+str(instagram_token) | |
r = requests.get(url) | |
return r.json() |
View script_cron
This file contains 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
gcloud scheduler --project micheleone \ | |
jobs create http import_catalog_xmq5ynl8i2i \ | |
--time-zone='America/Los_Angeles' \ | |
--schedule='0 0 * * *' \ | |
--uri='https://retail.googleapis.com/v2alpha/projects/***********/locations/global/catalogs/default_catalog/branches/1/products:import' \ | |
--description='Import Retail catalog data' \ | |
--headers='Content-Type: application/json; charset=utf-8' \ | |
--http-method='POST' \ | |
--message-body='{"inputConfig":{"bigQuerySource":{"projectId":"project-id","datasetId":"retail","tableId":"catalog","dataSchema":"product"}},"reconciliationMode":"INCREMENTAL"}' \ | |
--oauth-service-account-email='' |
View example_dict.txt
This file contains 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
{"id": sku,"categories":categories],"title":description,"priceInfo":[{"currencyCode":"USD"},{"price":float(exact_price)},{"originalPrice":float(exact_price)},{"cost":float(exact_price)}]} |
View schema_google_retail.json
This file contains 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
[ | |
{ | |
"name": "product_metadata", | |
"type": "RECORD", | |
"mode": "NULLABLE", | |
"fields": [ | |
{ | |
"name": "images", | |
"type": "RECORD", | |
"mode": "REPEATED", |
View google_importer.py
This file contains 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 modules import defines | |
import ndjson | |
from google.cloud import bigquery | |
import pymysql | |
database = pymysql.connect(host='IP', user='USER', passwd='PWD', db='DB_NAME',use_unicode=True, cursorclass=pymysql.cursors.DictCursor, charset="utf8") | |
def select_exe(query_select): | |
mydb = pymysql.connect(host='IP', user='USER', passwd='PWD', db='DB_NAME',use_unicode=True, cursorclass=pymysql.cursors.DictCursor, charset="utf8") | |
try: |
NewerOlder