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
def get(obj, key: str | int, default=None): | |
""" | |
Try to get index, key or a property | |
for a given list, dict or object, | |
returns default on error | |
Params: | |
- obj: mixed - dict, list, object | |
- key: str - either any key or dot accessor like: foo.bar.0 |
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
#!/usr/bin/env python | |
# - * -coding: utf - 8 - * - | |
""" | |
This very simple CLI application is used to automate process of recreating existing database or creating new one. | |
It's written in Python 3.6. and it uses MySQLdb library for connection with database. | |
On start, it asks for credentials. You can just skip inputs (by pressing enter) for default values. | |
If you don't have MySQLdb package, install it with: | |
`sudo apt-get install python-pip python-dev libmysqlclient-dev python3-mysqldb` | |
""" |
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
/** | |
* 1. Load a page: https://fontawesome.com/icons?d=gallery | |
* 2. Press F12 and paste the code in the console | |
* 3. Wait until all data is fetched and packed | |
* 4. Use downloader.dump() to get JSON | |
**/ | |
class FontAwesomeDownloader { | |
static proIconsClass = 'gray4'; /* parent */ | |
static visibleIconsSelector = '#results-icons i'; |
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
<?php | |
namespace App\Console\Commands; | |
use PDO; | |
use PDOException; | |
use Illuminate\Console\Command; | |
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
CREATE TABLE IF NOT EXISTS `t_list_row` ( | |
`_row` int(10) unsigned NOT NULL, | |
PRIMARY KEY (`_row`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; | |
INSERT t_list_row VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15), (16), (17), (18), (19), (20), (21), (22), (23), (24), (25), (26), (27), (28), (29), (30), (31), (32), (33), (34), (35), (36), (37), (38), (39), (40), (41), (42), (43), (44), (45), (46), (47), (48), (49), (50), (51), (52), (53), (54), (55), (56), (57), (58), (59), (60), (61), (62), (63), (64), (65), (66), (67), (68), (69), (70), (71), (72), (73), (74), (75), (76), (77), (78), (79), (80), (81), (82), (83), (84), (85), (86), (87), (88), (89), (90), (91), (92), (93), (94), (95), (96), (97), (98), (99), (100), (101), (102), (103), (104), (105), (106), (107), (108), (109), (110), (111), (112), (113), (114), (115), (116), (117), (118), (119), (120), (121), (122), (123), (124), (125), (126), (127), (128), (129), (130), (131), (132), (133), (134), (135), (136), (137), (13 |
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
""" | |
About: | |
Script for playing with recursion in python, by calculating factorial of number n | |
Supported versions: | |
>= 2.7 | |
Examples: | |
factorial.py 100 | |
factorial.py 100 -jt (display just seconds, without results) |