Skip to content

Instantly share code, notes, and snippets.

View lhotari's full-sized avatar

Lari Hotari lhotari

View GitHub Profile
@lhotari
lhotari / DefaultKeyBinding.dict
Last active December 11, 2023 13:11 — forked from trusktr/DefaultKeyBinding.dict
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@lhotari
lhotari / debug_github_actions.md
Last active September 29, 2022 09:52
GitHub Actions debugging tip: connect to the running build with ssh

GitHub Actions debugging tip: You can connect to the running build with ssh and get a shell within the GitHub Actions runner VM.

The recommended approach is to run the build in a PR in your own fork and make only temporary changes to enable the ssh shell. GitHub Actions runs within your own fork when you open a PR to your own fork. Before opening the PR, it's useful to sync your fork's master branch with origin/master. Please check instructions for "Personal GitHub Actions CI" in the dev mailing list archives.

Here's an example of SSH debugging I have: lhotari/pulsar-helm-chart#1 . I removed all other GitHub Actions workflows and added this action step to the workflow where I wanted to connect with ssh:

      - name: Setup upterm session
        uses: lhotari/action-upterm@v1
 with:
@lhotari
lhotari / clean_microk8s_registry.sh
Created April 21, 2021 04:02 — forked from Kevinrob/clean.md
Clean up microk8s registry
#!/bin/bash
registry=localhost:32000
repositories=$(curl ${registry}/v2/_catalog)
for repo in $(echo "${repositories}" | jq -r '.repositories[]'); do
echo $repo
tags=$(curl -sSL "http://${registry}/v2/${repo}/tags/list" | jq -r '.tags[]')
for tag in $tags; do
echo $tag
curl -v -sSL -X DELETE "http://${registry}/v2/${repo}/manifests/$(
curl -sSL -I \
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGBRm5gBEADoGdMtbyvaBJXG1xEX6138mT5UNsBKbKIoR7ivuIoXjhoGIiHm
1Ow9yw+8blL7tVaJLQzwmBg/1fJTfuLb4OUqSEEGL7sHssDoMLTfRD8K0owlJpW/
baiI9tM2KyIHhkUxbnBg+wzX5zeoTW6WCZWOAUfXgzfHAEscWLGc9mb15aZppkK2
TvDgBiLXKfgjUr7znSdWwWOh8Wzs1aMijLzg86Q+1hKsR7F1ZSqIELa8KUWcW0Wi
bqq4UD5xka7DZTIRzPkLfAdyAaIFauGiq2DyswNJFBGRul8RjZGnOxadZPmJB2iB
ukBZQGGVirNBVRSOKELSmbS3+zQnopyic0/dZS4/caE9YMgfLnv8AQAfFbzn8gzK
2KdLheH8F5FLekMCx70mtIDCI9L7nI2OUJk0YGjQkpqnGjI8j4OI3XPyLO1aQeyH
lce1xEsoZOx6fBVtO275Fo0kKKZJ6ToAbXSijc1o1iSszV4saeGXE+G8PbOOK40W
@lhotari
lhotari / smx8fancontrol
Last active December 17, 2020 20:31 — forked from ikus060/smx8fancontrol
Python script to edit the X8DTU-F Registry to control fan speed.
#!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
@lhotari
lhotari / configure_grub_for_dell_7480.sh
Created October 25, 2019 03:26
Ubuntu 18.04 Linux kernel settings for Dell Latitude 7480
#!/bin/bash
sudo apt-get update
sudo apt-get install --install-recommends linux-generic-hwe-18.04 xserver-xorg-hwe-18.04
sudo mkdir /etc/default/grub.d
# adjust i915 related kernel parameters
# references for different settings:
# intel_iommu=igfx_off - https://bugs.archlinux.org/task/55629
# intel_idle.max_cstate=4
@lhotari
lhotari / ubuntu_install.sh
Last active July 4, 2022 15:45
Ubuntu install
apt-get install autojump zsh tig git htop vim wget
apt-get install apt-transport-https ca-certificates curl software-properties-common
apt-get install libgnome-keyring-dev && (cd /usr/share/doc/git/contrib/credential/gnome-keyring && make)
apt-get install indicator-sysmonitor
apt-get install keepass2
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get install linux-generic-hwe-16.04 linux-image-generic-hwe-16.04 linux-tools-generic-hwe-16.04 linux-image-extra-virtual-hwe-16.04
sudo apt-get install xserver-xorg-hwe-16.04
#!/bin/bash
# Disables Spotlight / mdworker and Time Machine backups for all build and .gradle directories under the working directory.
/usr/bin/find . '(' -name build -or -name .gradle ')' -exec touch "{}/.metadata_never_index" \;
/usr/bin/find . '(' -name build -or -name .gradle ')' -exec xattr -w com.apple.metadata:com_apple_backup_excludeItem com.apple.backupd "{}" \;
// Example of using StAX to split a large XML document and parse a single element using XmlSlurper
import javax.xml.stream.XMLInputFactory
import javax.xml.stream.XMLStreamReader
import javax.xml.transform.Transformer
import javax.xml.transform.TransformerFactory
import javax.xml.transform.sax.SAXResult
import javax.xml.transform.stax.StAXSource
def url = new URL("http://repo2.maven.org/maven2/archetype-catalog.xml")