Skip to content

Instantly share code, notes, and snippets.


Pham Ba Cuong Quoc pbcquoc

View GitHub Profile
pbcquoc /
Created Jul 6, 2018
multiprocess write to single file python
import multiprocessing as mp,os
from datetime import timedelta, date
import os
def daterange(date1, date2):
for n in range(int ((date2 - date1).days)+1):
yield date1 + timedelta(n)
def unwrap_self(cls, kw1, kw2):
cls.process_wrapper(kw1, kw2)
pbcquoc /
Created May 30, 2018
python convert string to ipv4 in the correct way.
import socket, struct
def str2ip(ip):
"Convert dotted IPv4 address to integer."
packedIP = socket.inet_aton(ip)
return struct.unpack("!i", packedIP)[0]
pbcquoc /
Created Oct 12, 2017 — forked from jezdez/
A Python script to check if a character is or a text contains emoji
# -*- encoding: utf-8 -*-
# pip install emoji
import emoji
def char_is_emoji(character):
return character in emoji.UNICODE_EMOJI
You can’t perform that action at this time.