Skip to content

Instantly share code, notes, and snippets.

View batmat's full-sized avatar
😞
I may be very very slow to respond.

Baptiste Mathus batmat

😞
I may be very very slow to respond.
View GitHub Profile
@batmat
batmat / keybase.md
Created February 5, 2015 06:22
keybase.md

Keybase proof

I hereby claim:

  • I am batmat on github.
  • I am bmathus (https://keybase.io/bmathus) on keybase.
  • I have a public key whose fingerprint is 7207 4617 7725 A892 07A7 075B FD5D EA07 FCB6 90A8

To claim this, I am signing this object:

@batmat
batmat / NonNullUtil.java
Created May 6, 2015 09:40
SONARJAVA-985 Example
package xxxxx.utils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@batmat
batmat / eclipse-tips.adoc
Last active August 29, 2015 14:21
WIP list of Eclipse tips & tricks (mainly for the Java IDE)

List of tips to cover

  1. Refactoring: Extract method?

  2. Typing: automatically place semicolons

  3. Typing: escape text when pasting into a string literal

  4. Do not always remember the shortcuts? Find any option with Ctrl-Shift-3

  5. Organize imports: how to ignore javadoc

  6. Formatter: don’t touch my manually wrapped lines!

  7. Formatter: don’t touch that part (using begin/end tags). Thx Emmanuel Fontan)

@batmat
batmat / KDE5-unstable.adoc
Last active August 29, 2015 14:22
KDE / Plasma 5 unstabilities

KDE 5 (Plasma) issues

Wildly unstable

Goes without saying, anything below was working fine with KDE4.

Autostart

Autostart apps configured for .kde4 previously are now just ignored. The format totally changed: from simple symlink before, you now have to create a still simple but far more complex than before file and put it elsewhere so that KDE5 starts your app.

@batmat
batmat / sonarqube-mysql-docker-compose.yml
Created July 15, 2015 22:32
Working SonarQube + Mysql Dead Simple Docker Compose file
sonarqube:
image: sonarqube:5.1.1
ports:
- "9000:9000"
- "3306:3306"
environment:
- SONARQUBE_JDBC_USERNAME=sonar
- SONARQUBE_JDBC_PASSWORD=sonar
- SONARQUBE_JDBC_URL=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
@batmat
batmat / crush-ze-docker-storage.sh
Last active August 29, 2015 14:28
Small PoC script showing the disk usage can grow very quickly with forgotten volumes (and it's not removable through docker rm[i])
#!/bin/bash
set -eou pipefail
COUNT=5
SIZE_IN_MB=500
while [[ $COUNT > 0 ]]; do
sudo du -sm /var/lib/docker
docker run -v /pouet debian fallocate -l ${SIZE_IN_MB}M /pouet/test.img
COUNT=$(( $COUNT - 1 ))
@batmat
batmat / forge-kids-gloves.adoc
Last active November 3, 2015 21:39
A Software Factory With Kid Gloves

Deliver software quickly and on a regular basis? Adapt to change? All that by hands?

In this session, I’ll explain how we went from a simple Hudson with some jobs a few years ago, to a complete software factory around Jenkins with several hundreds jobs today (Continuous Integration, Continuous Inspection…​).

I’ll give feedback on things that didn’t work, and things that work. Why and how put developers in control of their jobs. Tips & tricks to manage all that.

Finally, we’ll see ongoing and upcoming work designed to provide even more "Agility" to all that: job versioning, using Docker for reproducibility and auto-scaling, etc.

@batmat
batmat / jenkins-plugins-per-month.sh
Last active November 15, 2015 21:50
Small scripts to generate Jenkins data about number of plugins per months since 2007
# Quick & Dirty way to generate data for number of plugins per month
# after the .svg of installations per plugins available under stats.jenkinsci.org
# Get all the files
for year in $(seq 2007 2015)
do
for month in $(seq -w 1 12)
do
wget "http://stats.jenkins-ci.org/jenkins-stats/svg/$year$month-plugins.svg"
done
@batmat
batmat / get-jenkins-build-time.groovy
Last active June 3, 2024 04:27
Quick Jenkins system groovy script to compute how many minutes of build you had in the last N hours
def numberOfHoursBack = 7*24
def totalBuildTime =
Jenkins.instance.getItems(Job.class).collect { job ->
job.getBuilds().byTimestamp(System.currentTimeMillis()-numberOfHoursBack*60*60*1000, System.currentTimeMillis())
}
.flatten()
.collect { build -> build.getDuration() }
.sum()
@batmat
batmat / push_docker_swarm_stats.groovy
Last active November 24, 2015 15:56
Quick & certainly fragile script to gather informations from a docker swarm daemon /info Cf. https://github.com/docker/swarm/issues/735 for the clean way some day. Push to graphite also supported (see the end of the script)
// Quick & certainly fragile script to gather informations from a docker swarm daemon /info
// Cf. https://github.com/docker/swarm/issues/735 for the clean way some day
import groovy.json.*
def swarmInfoUrl = 'http://sv-t-vnl-ic-swarm:3375/info'
def graphiteHost = 'sv-t-vnl-forge-metrics'
def graphitePort = 2003
def nodeReservedMemoryField = 'reservedmemory'
def nodeTotalMemoryField = 'totalmemory'