Skip to content

Instantly share code, notes, and snippets.

View mkorpela's full-sized avatar

Mikko Korpela mkorpela

View GitHub Profile
@mkorpela
mkorpela / keyword_times.py
Last active February 4, 2024 11:40
Script that shows 100 most time consuming keywords in Robot Framework output.xml
from functools import total_ordering
from robot.api import ExecutionResult, ResultVisitor
import math, re
class KeywordTimes(ResultVisitor):
VAR_PATTERN = re.compile(r'^(\$|\@)\{[^\}]+\}(, \$\{[^\}]+\})* = ')
def __init__(self):
class MazeSolver:
def __init__(self, maze):
self.maze = maze
self.rows = len(maze)
self.cols = len(maze[0])
self.start = self.find_start()
self.position = self.start
self.visited = set([self.start])
self.path = [self.start]
I want only answers that I can validate. I want only reasoning based on facts.
I'm happy to answer questions.
Thoroughly analyze the situation.
Topic: {MY_TOPIC}
Please feel free to ask me any questions to gather more information or clarify any points.
### Task ###
Help a dyslexic person to understand a text.
Use as simple vocabulary as possible.
Use only uppercase letters.
Keep the text and sentences short.
Explain in {LANGUAGE}.
After the explanation, give numbered options to choose from for the person to make follow-up questions about the text. Only refer to this original text. Explain in {LANGUAGE} that the text does not contain the answer if a question that is not covered is asked.
### Example ###
Text:
@mkorpela
mkorpela / find_unused.py
Created January 20, 2012 11:57
Finding unused Robot Framework user keywords
import sys
from robotide.controller.chiefcontroller import ChiefController
from robotide.controller.commands import NullObserver
from robotide.controller.filecontrollers import DirectoryController
from robotide.namespace import Namespace
from robotide.spec.iteminfo import LibraryKeywordInfo
from robotide.usages.commands import FindUsages
def construct_chief_controller(datapath):
@mkorpela
mkorpela / print_output_stats.py
Last active May 12, 2020 09:55
Robot Framework output file size statistics
import xml.etree.ElementTree as ET
def sizes(element, result):
if element.tag not in result:
result[element.tag] = [0, 0]
result[element.tag][1] += 1
size_before = result[element.tag][0]
this_size = 5 + 2*len(element.tag) + \
len(element.text or "") + \
@mkorpela
mkorpela / libbi.py
Created March 13, 2012 13:58
Monkey that somehow got out of his cage
from robot.libraries.BuiltIn import BuiltIn
def run_flat(name, *args):
"""
This keyword flattens robot logs. Only messages will be logged - no keyword structure.
"""
from robot.output import LOGGER
s, e = LOGGER.start_keyword, LOGGER.end_keyword
LOGGER.start_keyword = LOGGER.end_keyword = lambda *_:0
try:
# Copyright 2014-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@mkorpela
mkorpela / gist:684c2a9b7a8da4478e41650488a628fa
Created July 26, 2017 09:33
0x9FfB55c4cCe469269F8B51aFA9Fe0C951bb3AD8C
0x9FfB55c4cCe469269F8B51aFA9Fe0C951bb3AD8C

Keybase proof

I hereby claim:

  • I am mkorpela on github.
  • I am mkorpela (https://keybase.io/mkorpela) on keybase.
  • I have a public key whose fingerprint is E5F5 E73B A4AC 54CF E7B6 64E9 FB29 B59F 6332 4A5E

To claim this, I am signing this object: