- Related Setup: https://gist.github.com/hofmannsven/6814278
- Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
- Interactive Beginners Tutorial: http://try.github.io/
- Git Cheatsheet by GitHub: https://services.github.com/on-demand/downloads/github-git-cheat-sheet/
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 face_recognition | |
import cv2 | |
import numpy as np | |
# This is a demo of running face recognition on live video from your webcam. It's a little more complicated than the | |
# other example, but it includes some basic performance tweaks to make things run a lot faster: | |
# 1. Process each video frame at 1/4 resolution (though still display it at full resolution) | |
# 2. Only detect faces in every other frame of video. | |
# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam. |
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 face_recognition | |
import cv2 | |
import numpy as np | |
# This is a demo of running face recognition on live video from your webcam. It's a little more complicated than the | |
# other example, but it includes some basic performance tweaks to make things run a lot faster: | |
# 1. Process each video frame at 1/4 resolution (though still display it at full resolution) | |
# 2. Only detect faces in every other frame of video. | |
# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam. |
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 pandas as pd | |
import pdfkit | |
from PyPDF2 import PdfFileMerger | |
import os | |
import math | |
df = pd.read_excel('CALCOLATORE PREVENTIVI.xls', sheet_name='CALCOLATORE') # col = 1, row = 2 | |
var1 = df.loc[3][7] | |
raw_var1 = var1.split('\n') |
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 | |
import pandas as pd | |
import datetime | |
import os | |
import logging | |
from bs4 import BeautifulSoup | |
import re | |
now = datetime.datetime.now() | |
todays_date = str(now).split()[0] |
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
class MyStreamListener(tweepy.StreamListener): | |
def __init__(self, api=None): | |
super(MyStreamListener, self).__init__() | |
self.num_tweets = 0 | |
self.file = open("tweets.txt", "w") | |
def on_status(self, status): | |
tweet = status._json | |
self.file.write( json.dumps(tweet) + '\n' ) | |
self.num_tweets += 1 |
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
There is a known method to emulate a container for variables, which support both methods of access: by a variable's name and a string key. | |
class Vars: | |
def __init__(self, **kw): | |
self.__dict__.update(kw) | |
def __getitem__(self, key): | |
return self.__dict__[key] | |
def __setitem__(self, key, val): |
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
# http://en.wikipedia.org/wiki/Extreme_points_of_the_United_States#Westernmost | |
top = 49.3457868 # north lat | |
left = -124.7844079 # west long | |
right = -66.9513812 # east long | |
bottom = 24.7433195 # south lat | |
def cull(l): | |
c = [] | |
for (lat, lng) in l: | |
if bottom <= lat <= top and left <= lng <= right: |
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_weather(latitude_,longitude_): | |
# latitude = latitude_ | |
# longitude = longitude_ | |
# url = 'http://api.openweathermap.org/data/2.5/weather?lat={}&lon={}&appid=8f47bbfcc82517d109015de292ab80cd&units=metric'.format(latitude, longitude) | |
# res = requests.get(url) | |
# data = res.json() | |
response = dict(main="Haze",desc="haze",temp=18,pressure=1014,humidity=72,temp_min=18,temp_max=18,wind_speed=1.5,wind_degree=310,datetime=1544556600,clouds_all=20,sys_sunrise=1544488256,sys_sunset=1544526753) | |
return response |
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 os | |
import pandas as pd | |
import numpy as np | |
import random | |
import django | |
from django.utils import timezone | |
from populate_weather import get_location,get_weather | |
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'categorized_affect_map.settings') | |
django.setup() |