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 concurrent.futures | |
from time import time | |
def count_digits(input_str): | |
count = {} | |
for s in input_str: | |
if s.isdigit(): | |
count[s] = count.get(s, 0) + 1 | |
return count |
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 json | |
from pprint import pprint | |
from datetime import datetime | |
import requests | |
from facebook_user_crawler import FbBaseCrawler | |
""" | |
FbBaseCrawler can be found here https://gist.github.com/gearazk/7e5a7178dfdee70222bdeb9d8e8d155e | |
""" | |
class FbUserListCrawler(FbBaseCrawler): |
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
What industry do you want to find ? : football | |
crawl_now123123 | |
{'100002702009223': {'owner_name': 'Lê Hoàng Trung'}, '100014229676316': {'owner_name': 'Hoài Nam'}} | |
Page 1 completed | |
{'100014229676316': {'owner_name': 'Hoài Nam'}, '100002702009223': {'owner_name': 'Lê Hoàng Trung'}, '100009394937400': {'owner_name': 'Thuỳ Nguyên'}} | |
Page 2 completed | |
{'100014229676316': {'owner_name': 'Hoài Nam'}, '100003842806973': {'owner_name': 'Hữu Nhẫn Võ'}, '100002702009223': {'owner_name': 'Lê Hoàng Trung'}} | |
Page 3 completed | |
{'100002702009223': {'owner_name': 'Lê Hoàng Trung'}, '100002217636076': {'owner_name': 'Huỳnh Hanh Thông'}} | |
Page 4 completed |
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 json | |
from pprint import pprint | |
import requests | |
from bs4 import BeautifulSoup as BS | |
import facebook | |
class FbBaseCrawler(object): | |
default_headers = { | |
'Accept' :'*/*', |
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
// https://docs.google.com/presentation/d/1rrYLHVR3_Fc7mmvc8I8zGOhtoBDN02RjF_-aecimZdg/edit?usp=sharing | |
#include <NewPing.h> | |
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. | |
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor. | |
#define MAX_DISTANCE 100 // Maximum distance we want to ping for (in centimeters). Maximum sensor | |
#define US_ROUNDTRIP_CM 58 | |
void setup() { | |
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. | |
pinMode(ECHO_PIN, OUTPUT);// Open serial monitor at 115200 baud to see ping results. |
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
# sudo add-apt-repository ppa:certbot/certbot && sudo apt-get update && sudo apt-get install -y python-certbot-nginx | |
# sudo certbot --nginx -d {domain}.com -d www.{domain}.com | |
# django app | |
# ... | |
# Check cronjobs | |
# cat /etc/cron.d/certbot | |
# Expires map cache | |
map $sent_http_content_type $expires { | |
default off; |
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
$.ajax({ | |
method: "POST", | |
url: '{% url 'aj_location' %}', | |
dataType:'json', | |
data: {'data':this.dataset.gmap}, | |
success: function(data){ | |
if(data.is_saved){ | |
alert('Added '+data.data.name); | |
}else{ |
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 bs4 import BeautifulSoup as BS | |
import requests | |
class BaseCrawler(object): | |
api_url = None | |
default_headers = { | |
'Accept-Language' :'en-US,en,q=0.9,vi;q=0.8', |
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 bs4 import BeautifulSoup as BS | |
import requests | |
class BaseCrawler(object): | |
api_url = None | |
default_headers = { | |
'Accept-Language' :'en-US,en,q=0.9,vi;q=0.8', |
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
$.ajaxSetup({ | |
headers: { 'X-CSRFToken': "{{ csrf_token }}" } | |
}); |
NewerOlder