Skip to content

Instantly share code, notes, and snippets.

View nix010's full-sized avatar

Nix nix010

  • Lisbon, Portugal or HCM, Vietnam
  • 20:49 (UTC +01:00)
View GitHub Profile
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
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):
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
@nix010
nix010 / FbContactCrawler.py
Last active September 27, 2022 21:40
Crawl Facebook profile of user by user fbid
import json
from pprint import pprint
import requests
from bs4 import BeautifulSoup as BS
import facebook
class FbBaseCrawler(object):
default_headers = {
'Accept' :'*/*',
// 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.
# 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;
$.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{
@nix010
nix010 / base_crawler.py
Last active February 26, 2019 09:49
Crawl pictures from Pinterest by search a keyword | 26 Jan, 2018 (TESED )
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',
@nix010
nix010 / base_crawler.py
Created January 26, 2018 19:11
crawl pictures from Pinterest by search a keyword
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',
@nix010
nix010 / django_stuffs
Created January 19, 2018 15:06
snippets Django
$.ajaxSetup({
headers: { 'X-CSRFToken': "{{ csrf_token }}" }
});