> mysql> show global variables like 'max_allowed_packet';
>
> +--------------------+----------+
>
| Variable_name | Value |
>
+--------------------+----------+
>
| max_allowed_packet | 16777216 |
import sys
if sys.version_info[0] == 3:
is_prime = lambda n: not any(filter(lambda x: n % x == 0, range(2, n)))
elif sys.version_info[0] == 2:
import itertools
is_prime = lambda n: not any(itertools.ifilter(lambda x: n % x == 0, range(2, n))
# 0. Prerequistes
sudo yum install pcre-devel xz-devel zlib-devel -y
# 1. Get the code
cd /usr/local/src
sudo git clone https://github.com/ggreer/the_silver_searcher.git
# 2. Build and install it
cd the_silver_searcher && sudo ./build.sh && sudo make install
from datetime import datetime, timedelta
def range_of_datetime(interval: timedelta, size:(int, None)=None, start:(datetime, None)=None, end:(datetime, None)=None):
if start is None and end is None and size is None:
raise Exception('Supply 3 arguments at least')
zero_timedelta = timedelta()
if start is not None and end is not None:
if (start < end and interval > zero_timedelta) or (start > end and interval < zero_timedelta):
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
# Version 1.0.1 | |
def retry(times=5, interval=15, max_interval=600): | |
def _iter(n, fn, *args, **kwargs): | |
try: | |
res = fn(*args, **kwargs) | |
return res |
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
(defn generate-rand-str | |
([] (generate-rand-str 4)) | |
([n] | |
(apply str | |
(map | |
(fn [_] (rand-int 10)) | |
(range n))))) |