Skip to content

Instantly share code, notes, and snippets.

@scorpp
scorpp / README.md
Created May 30, 2025 16:46
PlantUML rendering GitHub Action

Rendering PlantUML with GitHub Actions

None of existing GitHub Actions is perfect, most are outdated, others use PlantUML Server, which doesn't work well for private repos.

What's included

  • Flow triggers for *.puml file changes only
  • Uses latest PlantUML docker image (but version could be adjusted)
  • Allows you to customise any aspect of rendering by adjusting CLI args
  • Commits rendered images automatically in a separate commit

That's all was made possible by using nice tj-actions/docker-run action.

@scorpp
scorpp / capture-audio.sh
Created March 16, 2018 11:07
Capture audio from desktop + mic with pulseaudio
#!/bin/bash
#
# Usage:
#
# capture-audio.sh [ffmpeg args]
#
function get_default_sink_or_source() {
SINK_OR_SOURCE=$1
@scorpp
scorpp / rancher-update-service.sh
Created November 11, 2016 17:39
Jenkins script to upgrade a service on Rancher
test -f JSON.sh || curl -O https://raw.githubusercontent.com/dominictarr/JSON.sh/master/JSON.sh
eval $(sed 's/^/MY_/' build.info)
ORIG_LAUNCH_CONFIG=$(cat my-app-service.json | bash ./JSON.sh | grep -F '["launchConfig"]' | sed -e 's/[^{]*//')
NEW_LAUNGH_CONFIG=$(echo $ORIG_LAUNCH_CONFIG |\
sed "s/\(\"imageUuid\"\):\"[^\"]*\"/\1:\"docker:my-image:${MY_BUILD_NUMBER}\"/")
echo $NEW_LAUNGH_CONFIG |\
xargs -d\\n -i_-_ curl -v -u "RANCHER_KEY:RANCHER_SECRET" \
-X POST -H 'Content-Type: application/json' \
-d '{"inServiceStrategy":{"launchConfig": _-_ }}' \
@scorpp
scorpp / docker-pulse-server.sh
Last active July 16, 2019 14:33
Run pulseaudio server in docker container
docker run --rm -ti \
--device=/dev/snd/controlC0 --device=/dev/snd/pcmC0D0p --device=/dev/sndpcmC0D1p --device=/dev/snd/timer \
-p 4713:4713 \
rpi-deb-pulse \
/bin/bash -c "groupadd --gid $(ls -l /dev/snd/controlC0 | cut -d' ' -f4 | xargs getent group | cut -d: -f3) alsadev \
&& gpasswd -a pulse alsadev \
&& pulseaudio --system --high-priority --no-cpu-limit -v \
-L 'module-alsa-sink device=hw:0,0' \
-L 'module-native-protocol-tcp auth-ip-acl=10.2.0.0/24'"
@scorpp
scorpp / proxmox-backup-hook.sh
Last active December 29, 2020 13:40
Hetzner backup hook to mount Hetzner backup space
#!/bin/bash
# vzdump hook script that handles mounting of [Hetzner] backup space
# [over SFTP] and then mounting an FS image stored there.
# After backup is done backup image is remounted to ensure data synced.
# Relies on /etc/fstab entries for backup mount points and pub key auth
# for SFTP.
#
# Corresponding fstab enties:
# [email protected]: /mnt/backup-space fuse.sshfs defaults,noauto,allow_root,_netdev 0 0
# /mnt/backup-space/image /mnt/backup ext4 noauto,defaults,loop 0 0
@scorpp
scorpp / skype-toggle.py
Created December 31, 2014 14:19
Skype: show\hide main window
#!/usr/bin/python2
import dbus
import os
remote_bus = dbus.SessionBus()
out_connection = remote_bus.get_object('com.Skype.API', '/com/Skype')
out_connection.Invoke('NAME SkypeToggler')
out_connection.Invoke('PROTOCOL 5')
@scorpp
scorpp / skype-mute.py
Created December 31, 2014 14:18
Skype: mute\unmute current call
#!/usr/bin/python2
import sys
import traceback
import re
import dbus
import dbus.service
#for event loop
import gobject
from dbus.mainloop.glib import DBusGMainLoop
@scorpp
scorpp / skype-search.pl
Created December 31, 2014 14:16
Skype: focus main win and prepare it for typing in contact name
#!/usr/bin/perl
use strict;
use warnings;
use Net::DBus;
my $session = Net::DBus->session;
my $service = $session->get_service('com.Skype.API');
@scorpp
scorpp / gist:9207503
Last active August 29, 2015 13:56
Find all java files in current directory and move them in maven-correct directory with git
find . -type f -name '*.java' | \
while read f; do \
target=$(grep '^package ' $f | sed -e 's/package \+//' -e 's/;$//' -e 's/\./\//g'); \
newf="src/main/java/${target}/$(basename $f)"; \
mkdir -p $(dirname $newf); \
git mv $f $newf; \
chmod 644 $newf; \
done
@scorpp
scorpp / git merge a subdirectory
Last active December 19, 2015 09:39
GIT merge a subdirectory from another repo\branch
# http://stackoverflow.com/a/12048161/679052
$ git remote add Bar /path/to/bar
$ git merge -s ours --no-commit Bar/master
$ git read-tree --prefix=public/bar -u Bar/master:www/tools/