Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
import glob | |
import requests | |
import markovify | |
from tqdm import tqdm | |
TELEGRAM_TOKEN = os.environ['TELEGRAM_TOKEN'] | |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 dateutil.rrule import rrule, WEEKLY | |
from datetime import datetime as dt | |
r = rrule(WEEKLY, interval=2, dtstart=dt(2018, 1, 27, 10)) | |
print(r.after(dt.utcnow()).strftime('%A, %d %B at %H%p')) |
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 babel import Locale | |
es = Locale('es') | |
pt = Locale('pt') | |
ru = Locale('ru') | |
print es.time_zones['America/New_York']['city'] | |
print pt.time_zones['America/New_York']['city'] | |
print ru.time_zones['America/New_York']['city'] |
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 pytz | |
import os | |
def guess_timezone(city): | |
""" | |
Take the city name and try to guess the timezone | |
""" | |
tz_map = {tz.split('/')[-1].lower(): tz for tz in pytz.all_timezones} | |
try: |
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
#!/bin/bash | |
export TZ='Europe/Moscow' | |
exec open -na "Google Chrome" --args "--user-data-dir=$HOME/chrome-profile" |
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
<? | |
$utc = new DateTimeZone('UTC'); | |
$user_tz = new DateTimeZone('Europe/Moscow'); | |
// current time in UTC | |
date_default_timezone_set('UTC'); | |
$datetime = new DateTime(); | |
// convert current time to user's local time | |
$datetime->setTimezone($user_tz); |
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
>>> bitmapist.mark_unique('foo', 1) | |
>>> bitmapist.mark_unique('foo', 1000) | |
>>> bitmapist.mark_unique('bar', 1) | |
>>> list(bitmapist.UniqueEvents('foo') & ~bitmapist.UniqueEvents('bar')) | |
[] | |
>>> list(bitmapist.UniqueEvents('foo') ^ bitmapist.UniqueEvents('bar') & bitmapist.UniqueEvents('foo')) | |
[1000] |