Skip to content

Instantly share code, notes, and snippets.

View guma44's full-sized avatar

Rafal Gumienny guma44

View GitHub Profile
Below are steps that should allow you to load the Training Plan with the Calendar to your watch.
It may look like a lot but it should only take a few minutes.
Connect your watch to the computer
Remove .fit files from the Garmin\Schedule, Garmin\Workouts directory and Garmin\Workouts\Schedule directory
Open Express > Select fenix 3 HR > Click Garmin Connect button to open your account in a web browser
These next steps are going to prompt Connect to sync your calendar to your watch because we are making a "change".
@guma44
guma44 / mac_key_map.md
Last active July 11, 2019 09:53
Switching right-hand Command & Alt key in Mac

Apple's Technical Note TN2450 describes how to remap keys. It is important to know that Right Command is also Right GUI. Running the following command will switch Right Command and Right Alt (if you also want to do the Left Command and Left Alt, refer to the technical note to get the hex values and the Python code below to do the or operation).

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x7000000e7,"HIDKeyboardModifierMappingDst":0x7000000e6},{"HIDKeyboardModifierMappingSrc":0x7000000e6,"HIDKeyboardModifierMappingDst":0x7000000e7}]}'

The table at the bottom of the Technical Note has a list of hex values for each key.

Here is the command to change in the same time the GB to US layout ie.:

  • map plus-minus key to tilda
@guma44
guma44 / regex.py
Last active September 27, 2018 07:00
Some useful regular expressions
import re
pdb_identification_regex = re.compile("^[1-9][a-zA-Z0-9]{3}$")
uniprot_identification_regex = re.compile("^[OPQ][0-9][A-Z0-9]{3}[0-9]$|^[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2}$")
aminoacid_sequence_regex = re.compile("^[GPAVLIMCFYWHKRQNEDST\n\r]{10,}$", re.I | re.M)
float_regex = re.compile(r"^-?(?:\d+())?(?:\.\d*())?(?:e-?\d+())?(?:\2|\1\3)$")
int_regex = re.compile(r"^(?<![\d.])[0-9]+(?![\d.])$")
email_regex = re.compile(r"(.+@[a-zA-Z0-9\.]+,?){1,}")
@guma44
guma44 / .gitconfig
Created October 30, 2017 10:20
A config for git
[user]
name = XX
email = [email protected]
[credential]
helper = cache
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
st = status
g = -c color.grep.linenumber=\"bold blue\" -c color.grep.filename=\"bold green\" -c color.grep.match=\"reverse yellow\" grep --break --heading --line-number
[color]
@guma44
guma44 / docker_setup.md
Last active October 25, 2017 09:17
Docker network setup in a company machine

SO

On the host, find out the primary and secondary DNS server addresses:

$ nmcli dev show | grep 'IP4.DNS'
IP4.DNS[1]:              10.0.0.2
IP4.DNS[2]:              10.0.0.3

Using these addresses, create a file /etc/docker/daemon.json:

@guma44
guma44 / autologging_setup.py
Created February 2, 2017 08:26
Set up auto-tracing for a class
from autologging import traced, TRACE
import logging
import sys
from logging import FileHandler
formatter = logging.Formatter(fmt="%(asctime)s - %(levelname)s:%(name)s:%(funcName)s:%(message)s")
console_handler = logging.StreamHandler()
console_handler.setFormatter(formatter)
logger = logging.getLogger(__name__)
logger.setLevel(TRACE)