Skip to content

Instantly share code, notes, and snippets.

View Sanne's full-sized avatar

Sanne Grinovero Sanne

View GitHub Profile
@Sanne
Sanne / 10-script.sh
Created October 3, 2023 11:48
Networkmanager listeners to reconfigure my local Maven proxies
#!/bin/sh
# Store as /etc/NetworkManager/dispatcher.d/10-script.sh
# make the script executable & owned by root. (protect it too!)
# Will trigger on up/down events of the selected network
HOME_CONNECTION_ID="TanaUB6"
LOG=/home/sanne/.m2/track-wifi-status-change
# echo "################" >> $LOG
# env >> $LOG
# echo "env HOME_CONNECTION_ID:" >> $LOG
public void compareAndSerialize(Object o) {
if (o instanceof Comparable) {
useComparable((Comparable) o);
}
if (o instanceof Serializable) {
useSerializable((Serializable) o);
}
}
@Sanne
Sanne / custom.cnf
Created September 12, 2022 15:48
MySQL configuration for testing
#
# MariaDB tuning meant for fast integration test execution:
# data is meant to be lost. Never use for actual database needs!
#
[mysqld]
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links = 0
@Sanne
Sanne / Maven mirror settings
Last active September 8, 2022 10:26
Optimised Maven settings.xml for within my home
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
</proxies>
<mirrors>
<mirror>
@Sanne
Sanne / OtherApp.java
Created May 12, 2022 13:13
Exploring scheduling strategy of async CompletableFuture(s)
import java.util.concurrent.CompletableFuture;
public class OtherApp {
private static final boolean wait = false;
public static void main(String[] args) {
VeryParallelExecutor executor = new VeryParallelExecutor( 4 );
OneOffDelegatingExecutor taskControl = new OneOffDelegatingExecutor( executor );
@Sanne
Sanne / git-update.sh
Last active January 16, 2017 18:17
git-update
#!/bin/bash
# Temporarily checks out the "master" branch, fetches updates from upstream,
# pushes a copy to "origin" to keep it in synch, and then returns to the original
# branch.
#
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
#
# Copyright (c) 2014 Sanne Grinovero
requireBranchName() {
#!/bin/sh
# version 20170828
# Backup script using rsync to create multiple snapshots of the source.
# A little known trick of rsync is to be able to run a three-way comparison,
# so to only transfer the diffs but store a full copy in a new directory,
# while comparing and hard linking to the previous snapshot.
# This allows to make many frequent snapshots at minimal network and storage
# impact.
#
# This version doesn't do any form of rotation: you'll eventually run out of space.
@Sanne
Sanne / gitPS1
Last active February 16, 2017 12:26
gitPS1
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1="$(if (( EUID == 0 )); then echo '\[\033[01;31m\]\h'; else echo '\[\033[5;32m\]\u@\h \[\033[00m\]\w\[\033[01;32m\]$(parse_git_branch)\[\033[00m\]$ '; fi)"
@Sanne
Sanne / release.sh
Created June 8, 2013 11:33
Search release script
SHORT_VERSION="4.3"
FULL_VERSION="4.3.0.Final"
NEXT_FULL_VERSION="4.3.1-SNAPSHOT"
##
# When editing the rsync commands, always test then with a dry run (-n) !
##
# Upload documentation to jboss.org:
@Sanne
Sanne / jenkins.appl
Last active December 13, 2015 22:08
BoxGrinder script: Jenkins machine for Hibernate
name: jenkins-hibernate
summary: Jenkins instance to run builds of Hibernate
version: 1
release: 1
os:
name: fedora
version: 17
password: yyy
hardware:
cpus: 4