Skip to content

Instantly share code, notes, and snippets.

import random
from datetime import timedelta, date
NUM_ORDERS = lambda: 1_000
NUM_ITEMS = lambda: random.randint(1, 10)
QTY = lambda: random.randint(1, 10)
PRICE = lambda: random.randint(99, 999) + 0.99
DATE = lambda: timedelta(days=random.randint(0, 365)) + date(2020, 1, 1)
@sebst
sebst / check_emoji.py
Created October 12, 2021 17:32
💡 How to check if a string contains emojis?
import re
emoji_pattern = re.compile("["
u"\U0001F600-\U0001F64F" # emoticons
u"\U0001F300-\U0001F5FF" # symbols & pictographs
u"\U0001F680-\U0001F6FF" # transport & map symbols
u"\U0001F1E0-\U0001F1FF" # flags (iOS)
"]+", flags=re.UNICODE)
re.search(emoji_pattern, "Hello World!")
from https://news.ycombinator.com/item?id=8336025
; <<>> DiG 9.8.3-P1 <<>> txt jamiehankins.co.uk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14302
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 2, ADDITIONAL: 3
;; QUESTION SECTION: