This file contains hidden or 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
| # The MIT License (MIT) | |
| # Copyright (c) 2016 Vladimir Ignatev | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining | |
| # a copy of this software and associated documentation files (the "Software"), | |
| # to deal in the Software without restriction, including without limitation | |
| # the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| # and/or sell copies of the Software, and to permit persons to whom the Software | |
| # is furnished to do so, subject to the following conditions: | |
| # |
This file contains hidden or 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
| # Works only for python 3.5 and above | |
| dict1 = {'a': 1, 'b': 2} | |
| dict2 = {'c': 3, 'd': 4} | |
| dict3 = {**dict1, **dict2} |
This file contains hidden or 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 bytesto(bytes, to, bsize=1024): | |
| """convert bytes to megabytes, etc. | |
| sample code: | |
| print('mb= ' + str(bytesto(314575262000000, 'm'))) | |
| sample output: | |
| mb= 300002347.946 | |
| """ | |
| a = {'k' : 1, 'm': 2, 'g' : 3, 't' : 4, 'p' : 5, 'e' : 6 } |
This file contains hidden or 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 | |
| import os, sys | |
| import random | |
| from timeit import timeit | |
| from collections import deque | |
| max = 100000 | |
| # Just a normal function |
This file contains hidden or 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 | |
| import os, sys | |
| import random | |
| from timeit import timeit | |
| from collections import deque | |
| # Generate random numbers | |
| max = 10 | |
| numbers = list() |
This file contains hidden or 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
| # Byte-compiled / optimized / DLL files | |
| __pycache__/ | |
| *.py[cod] | |
| *$py.class | |
| # C extensions | |
| *.so | |
| # Distribution / packaging | |
| .Python |
This file contains hidden or 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 | |
| from collections import deque | |
| if __name__ == "__main__": | |
| d = deque('abcd') | |
| print(d) | |
| # deque(['a', 'b', 'c', 'd']) |
This file contains hidden or 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 | |
| ''' | |
| Created on Aug 20, 2019 | |
| @author: kedarjos | |
| ''' | |
| import os | |
| import subprocess | |
| import datetime |
This file contains hidden or 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 perl | |
| # Author: Kedar Joshi | |
| package DBConnector; | |
| use DBI; | |
| # Constructor to build an object for db connection | |
| # Import this module and create object with: | |
| # my $obj = new DBConnector($host, $user, $password, $database, "mysql"); |