Skip to content

Instantly share code, notes, and snippets.

View perja12's full-sized avatar

Per Thomas Jahr perja12

View GitHub Profile
@perja12
perja12 / turn_off_ble_ue_boom_2.md
Last active May 1, 2024 19:45
Turn off BLE and always-on for UE BOOM 2 speaker to improve battery life

Use these commands to turn off BLE on the UE BOOM 2 speaker. The main reason for doing this is to avoid the battery drain when BLE is always on (even when turning off the device with the power button). This was added as "feature" to make it possible to turn on the speaker, but I want better battery life instead. I have used Fedora 39.

First pair the UE BOOM 2 speaker with the laptop and connect to it. Make sure to replace 88:C6:26:xx:xx:xx with the MAC address of your UE BOOM speaker. This can be found in Bluetooth settings in Fedora.

Note: uninstall the Android or iOS UE Boom App since it will enable BLE again!

Commands:

sudo rfcomm bind 0 88:C6:26:xx:xx:xx 1
@perja12
perja12 / partsbox_backup.sh
Created January 22, 2022 09:31
Download Partsbox data for backup (partsbox.com)
# Backup the partsbox database.
# Setup:
# 1. Generate the API key in settings of partsbox.com.
# 2. Store the API by using secret-tool (https://gitlab.gnome.org/GNOME/libsecret/issues):
# $ secret-tool store --label=partsbox provider partsbox
# (give the API key as input to password prompt)
curl \
-H 'Content-Type: application/json' \
-H 'Authorization: APIKey '$(secret-tool lookup provider partsbox)'' \
-o partsbox-export-$(date +%Y-%m-%d).json \
@perja12
perja12 / ssh_private_key_convert.md
Last active April 12, 2022 21:16
Convert SSH private key to classic format

If you generate a key pair with ssh-keygen you can, depending on version, get a private key with the header

-----BEGIN OPENSSH PRIVATE KEY-----

This type of key is not compatible with f.ex. jsch and needs to be converted so that it has the header

-----BEGIN RSA PRIVATE KEY-----

They way to convert existing keys is as follows: ssh-keygen -p -m PEM -f yourkeyfile

@perja12
perja12 / delete_artifacts.groovy
Created July 30, 2018 11:25
Delete artifacts from Jenkins with Groovy script.
// Delete old artifacts that fills up the disk on the master node.
// Run this from the Jenkins console (Manage Jenkins, Manage Nodes, master, Script Console)
def project = Jenkins.get().getItemByFullName('your-project-id')
def jobs = project.getAllJobs()
def total_size = 0
jobs.each{ job ->
def builds = job.getBuilds()

Keybase proof

I hereby claim:

  • I am perja12 on github.
  • I am perja (https://keybase.io/perja) on keybase.
  • I have a public key ASB8yELkAP6VqfyyFX8JIwYhpkHj16ldAzSn5ua_4vvFywo

To claim this, I am signing this object:

@perja12
perja12 / serial_test.ino
Created August 31, 2017 21:39
Using oscilloscope to decode serial output from Arduino Uno
/*
* How to decode serial output from Arduino Uno with a scope. Tested with Keysight DSOX1102G.
*
* 1. Connect probe on channel 1 (with 10x) to TX (pin 1) and ground clip to GND.
* 2. Scope settings:
* a. Press "default setup" to get into a known state.
* b. Press "trigger" button and choose mode = normal.
* c. Set to 1 V per division and time scale to 1 ms per time divison.
* d. Press "bus" and choose "serial bus" and "UART/RS232" as mode.
* e. Signals menu: RX 1, threshold 3V