Skip to content

Instantly share code, notes, and snippets.

Avatar

Pham Ba Cuong Quoc pbcquoc

View GitHub Profile
@pbcquoc
pbcquoc / multiprocess_write_file.py
Created Jul 6, 2018
multiprocess write to single file python
View multiprocess_write_file.py
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
pbcquoc / str2ip.py
Created May 30, 2018
python convert string to ipv4 in the correct way.
View str2ip.py
import socket, struct
def str2ip(ip):
"Convert dotted IPv4 address to integer."
packedIP = socket.inet_aton(ip)
return struct.unpack("!i", packedIP)[0]
@pbcquoc
pbcquoc / is_emoji.py
Created Oct 12, 2017 — forked from jezdez/is_emoji.py
A Python script to check if a character is or a text contains emoji
View is_emoji.py
# -*- 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.