Skip to content

Instantly share code, notes, and snippets.

Avatar

Lari Hotari lhotari

  • DataStax
  • Espoo, Finland
  • 15:48 (UTC +03:00)
  • Twitter @lhotari
View GitHub Profile
@lhotari
lhotari / debug_github_actions.md
Last active September 29, 2022 09:52
GitHub Actions debugging tip: connect to the running build with ssh
View debug_github_actions.md

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
View clean_microk8s_registry.sh
#!/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 \
View lari@hotari.net.gpg
-----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.
View smx8fancontrol
#!/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
View configure_grub_for_dell_7480.sh
#!/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
View ubuntu_install.sh
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"
View install_hwe_kernel_to_ubuntu16.04.sh
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
View disable_indexing_and_backups_for_build_dirs.sh
#!/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 "{}" \;
View splitted_xml_slurping.groovy
// 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")
@lhotari
lhotari / DiagnosticCommandMBeanHelper.java
Created May 6, 2015 17:20
dumping threads in code on Java8+
View DiagnosticCommandMBeanHelper.java
import javax.management.DynamicMBean;
import javax.management.MBeanException;
import javax.management.ReflectionException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class DiagnosticCommandMBeanHelper {
public static String threadPrint() throws ReflectionException, MBeanException {
try {