Skip to content

Instantly share code, notes, and snippets.

View micheleberardi's full-sized avatar
:octocat:
Life is good

Michele micheleberardi

:octocat:
Life is good
View GitHub Profile
@micheleberardi
micheleberardi / check_http_slack.py
Created September 9, 2019 01:40
controllo status httpd con notifica su slack
import os
from datetime import datetime
import redis
import logging
import time
from http.client import HTTPConnection, socket
"""
ciao
@micheleberardi
micheleberardi / fb_http_request_token_long_term.py
Last active September 9, 2019 22:47
Creazione di un token lunga durata
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-
"""
Request Token long termn
"""
__author__ = "Michele Berardi"
__copyright__ = "Copyright 2018, "
__license__ = "GPL"
import facebook
user_long_token = 'EAAHR3c1UymABABifeBxaSxYBQZBLaEqOFZBAnXlHrF9aYOJZAbs4QBZBcULQTC2uNwPylWf2pZBoZBoZAio0AgBQfG8YRd3hYMUIWnrHf4IoZA5ZAlgYqoVbZA27ucCXzeZCfTeNiwYecM48xXkKgHViJkAqorHeYZByhd7aUQQPP9NqzAZDZD'
graph = facebook.GraphAPI(access_token=user_long_token, version="3.1")
pages_data = graph.get_object("/me/accounts")
print(pages_data)
"""
graph = facebook.GraphAPI(access_token=page_token, version="3.1")
print(graph.get_object(id=page_id, fields='about, category'))
"""
OUTPUT PARAGRAFO [5]
{'about': 'Michelone', 'category': 'Blogger', 'id': '102927594431953'}
"""
@micheleberardi
micheleberardi / fb_request_http.py
Last active September 9, 2019 23:02
richiesta http
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-
"""
Request Token long termn
"""
import requests
def get_token(access_token_url):
@micheleberardi
micheleberardi / page_id_token.py
Last active September 9, 2019 23:01
page_id_token
page_id = '102927594431953'
page_token = None
for item in pages_data['data']:
if item['id'] == page_id':
page_token = item['access_token']
print(page_token)
"""
OUTPUT PARAGRAFO[4]:
@micheleberardi
micheleberardi / 3_VALUE
Created September 9, 2019 23:04
3_VALUE
app_id = '512225539574368'
app_secret = '9dc19451ce6a58d4e22e9634053f443f'
user_short_token = 'EAAHR3c1UymABAARMW95G9U3NlzSE8lvWbmnJtGr7GauH3aofCCCiZBcxBfZBNN1ZAxOOWMEzzFgJLZAR2QHYtvIMZChB4ykU5U6ZAgvjdRo3lKffPeLJTPDztQZC29lN3mG4rVFFzuQibSVGhbr9Onhzf6oxfGXNbOSD9Sag5D3XjTgoH2LrfEfkUrj0SeZCXoNr9xaT7ZBrFoAZDZD'
@micheleberardi
micheleberardi / dizionario_output
Created September 9, 2019 23:07
dizionario_output
{'data': [{'access_token': 'EAAHR3c1UymABAN6W47KDb08KLUcbNq8zJidVO4MJTx1SAZC{
'data': [
{
'access_token': 'EAAHR3c1UymABAN6W47KDb08KLUcbNq8zJidVO4MJTx1SAZCmAF6VqR92jesPIQt773U5ZCBxvnTE0HQC8t2HS8j1ctnZCvvqLIacKRLM6FhhLHNgf9Sqne61QIJ31Nt5MTI85rbm8xnHfAY7oabcfv6Oh3SWqLYDRLVn9dmwwZDZD',
'category': 'Blogger',
'category_list': [
{
'id': '361282040719868',
'name': 'Blogger'
}
@micheleberardi
micheleberardi / upgarde_checker
Created September 10, 2019 01:36
upgarde_checker
michelone@bd01$ ./mysqlsh root:@localhost:3307 -e "util.checkForServerUpgrade();"
mysqlsh: [Warning] Using a password on the command line interface can be insecure.
The MySQL server at localhost:3307 will now be checked for compatibility issues for upgrade to MySQL 8.0...
MySQL version: 5.7.24 - Source distribution
1) Usage of db objects with names conflicting with reserved keywords in 8.0
No issues found
2) Usage of utf8mb3 charset
No issues found
@micheleberardi
micheleberardi / tensorflow
Created September 11, 2019 20:38
tensorflow
sudo yum -y install epel-release
sudo yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel
# use pip or pip3 as you prefer for python or python3
pip install --upgrade virtualenv
virtualenv --system-site-packages ~/venvs/tensorflow
source ~/venvs/tensorflow/bin/activate
pip install --upgrade numpy scipy wheel cryptography #optional
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl
# or below if you want gpu, support, but cuda and cudnn are required, see docs for more install instructions
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0rc0-cp35-cp35m-linux_x86_64.whl