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 dowload_view(request): | |
| from django.http import HttpResponse | |
| rows = [['name', 'city', 'email'], ['Nitin', 'Bengaluru', 'nitinbhojwani1993@gmail.com']] | |
| response = HttpResponse(content_type='text/csv') | |
| response['Content-Disposition'] = 'attachment; filename="download.csv"' | |
| writer = csv.writer(response) | |
| for row in rows: | |
| writer.writerow(row) | |
| return response |
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
| sudo rabbitmqctl list_connections pid | while read pid ; do sudo rabbitmqctl close_connection ${pid} "go away" ; done |
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
| # To Get the list of all the processes | |
| show processlist; | |
| # kill connection or current query of a connection | |
| kill connection <connection_id> | |
| kill query <connection_id> | |
| # Currently Connections Count | |
| show status where `variable_name` = 'Threads_connected'; |
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
| # Calling | |
| print 'allowed input - any string without number(s) i.e. (^[[\S|\s][\d+][\S|\s]])' | |
| string_input = raw_input('Enter String: ') | |
| # using regex to validate the input | |
| import re | |
| if re.search(r'\d+', string_input): | |
| exit('error - string must not consist any number') |
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 num_to_words(num): | |
| units = ["", "one", "two", "three", "four", "five", | |
| "six", "seven", "eight", "nine "] | |
| teens = ["", "eleven", "twelve", "thirteen", "fourteen", | |
| "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] | |
| tens = ["", "ten", "twenty", "thirty", "forty", | |
| "fifty", "sixty", "seventy", "eighty", "ninety"] |
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
| from lxml import html | |
| import requests | |
| import csv | |
| import sys | |
| def fetchResult(z): | |
| print("Starting ... "+str(z)) | |
| resultList = [] | |
| drugnum = str(z) |
NewerOlder