Skip to content

Instantly share code, notes, and snippets.

View mkorpela's full-sized avatar

Mikko Korpela mkorpela

View GitHub Profile
@mkorpela
mkorpela / analysis.py
Last active October 1, 2024 11:41
Repository Activity Measure
# pip install gitpython numpy tqdm
import git
from collections import defaultdict
from datetime import timedelta
import numpy as np
import argparse
from tqdm import tqdm
def analyze_repo(repo_path, branch='main'):
repo = git.Repo(repo_path)
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 / 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 "") + \
# 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:

import cProfile
import pstats
from pabot.pabot import main
import os, sys
import tempfile
profile_results = tempfile.mktemp(suffix='.out', prefix='pybot-profile', dir='.')
cProfile.run('main(sys.argv[1:])', profile_results)
stats = pstats.Stats(profile_results)
stats.sort_stats('cumulative').print_stats(50)
class TrucksAvailable(object):
def __init__(self):
self._trucks_available = []
def add_truck(self, times):
for start, end in times:
self._add_truck_to_time_slice(start, end)
def _add_truck_to_time_slice(self, start, end):