Skip to content

Instantly share code, notes, and snippets.

@shubhamkumar13
Last active November 23, 2020 07:19
Show Gist options
  • Save shubhamkumar13/9da6a9307de3c771f1a48cfe5e84a4ad to your computer and use it in GitHub Desktop.
Save shubhamkumar13/9da6a9307de3c771f1a48cfe5e84a4ad to your computer and use it in GitHub Desktop.
snippet describing a way to get numbers for loop iterations for cached vs uncached
def get_diff(loop_list):
return [[(loop_list[i][0] - loop_list[i - 1][0]),(loop_list[i][1] - loop_list[i - 1][1])] for i in range(1, len(loop_list) - 1)]
sub_str1 = 'did minor gc'
sub_str2 = 'requested minor gc'
file1_filtered_lines = [line for line in file1_lines if line.find(sub_str1) == True or line.find(sub_str2) == True]
def get_numbers(string):
value = re.search('[0-9]+\.[0-9]+', string)
value_str = str(value.group(0))
value_lst = value_str.split('.')
return [int(value_lst[0]), int(value_lst[1])]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment