Skip to content

Instantly share code, notes, and snippets.

View mikahanninen's full-sized avatar

Mika Hänninen mikahanninen

  • Robocorp
  • Finland
View GitHub Profile
from RPA.Word.Application import Application
from win32com.client import constants
from typing import Any
from enum import Enum
class CursorPosition(Enum):
NO_MOVE = 0
START = 1
@mikahanninen
mikahanninen / DevExcel.py
Last active February 12, 2024 16:05
Keyword "Write data to range" for RPA.Excel.Application library
from RPA.Excel.Application import Application
from RPA.Tables import Table
from typing import Any, List, Union
class DevExcel(Application):
def __init__(self, autoexit: bool = True) -> None:
super().__init__(autoexit)
def write_data_to_range(
@mikahanninen
mikahanninen / example.py
Created May 2, 2023 14:04
Getting thread dump when Python gets stuck
import threading
from _pydevd_bundle import pydevd_utils
import time
def dump_threads_after_timeout():
time.sleep(5)
pydevd_utils.dump_threads()
def this_is_going_to_stuck():
@mikahanninen
mikahanninen / releasenote.txt
Created December 28, 2021 15:45
rpaframework-google release note 2.0.0
‎‎​
@mikahanninen
mikahanninen / modify.py
Created November 30, 2021 15:10
libspeccing
def modify_libspec_files():
files = list_all_libspec_files()
pattern = r"source=\"([^\"]+)"
sub_pattern = rf'source=".\{os.path.sep}\g<1>'
for f in files:
outfilename = f"{f}.modified"
with open(f) as file_in:
file_content = file_in.read()
with open(outfilename, "w") as file_out:
new_content = re.sub(
@mikahanninen
mikahanninen / README.md
Last active March 23, 2021 14:03
Using Robocorp Vault from Lab

Using Robocorp Vault from Lab

View credentials

rcc configure credentials

Add new Cloud Access Credential entry (if account has not been added before)

All user's Access Credentials are visible at https://cloud.robocorp.com

Offline Python Package Install Notes

Two common cases which make the install of Python packages harder due to networking issues are: a) Install behind a Proxy b) Install without access to the internet

(a) Install behind a Proxy

In the case where the target machine connects to the internet over a network proxy, export the following environment vars, as appropriate - http_proxy and https_proxy. Eg:

@mikahanninen
mikahanninen / README.md
Created December 13, 2020 08:15
get Google Maps suggestions

javascript

var texts = document.querySelector('.suggestions').innerText.split('\n') console.log(texts[Math.floor(Math.random()*texts.length)])

@mikahanninen
mikahanninen / readme.md
Created October 18, 2020 08:44
MacOS magic keyboard lag

Here's what did help fix my bluetooth lag:

  • Hold shift and option on your keyboard, then click on the bluetooth system menu.
  • The debug menu should appear (which you wouldn't see without holding shift and option).
  • Reset the Bluetooth module
  • Repeat steps 1 and 2 and then factory reset all connected apple devices.
  • Connect/pair the keyboard and mouse again.
@mikahanninen
mikahanninen / led.py
Created September 2, 2020 13:33 — forked from mickey-happygolucky/led.py
HTTP server with python
import RPi.GPIO as GPIO
class Led:
def __init__(self, pin):
self.pin = pin
self.s = 0
GPIO.setmode(GPIO.BOARD)
GPIO.setup(self.pin, GPIO.OUT)