Skip to content

Instantly share code, notes, and snippets.

@jgraglia
jgraglia / Jenkinsfile
Created July 11, 2017 10:38
Extended Choice Plugin in Jenkins pipeline
// YOU HAVE TO :
// 1. install the Extended Choice Parameter Plugin : https://wiki.jenkins.io/display/JENKINS/Extended+Choice+Parameter+plugin
// 2. Allow the instanciation of ExtendedChoiceParameterDefinition in you script approval admin page https://myjenkins/scriptApproval/
List params = []
List props = []
// https://github.com/jenkinsci/extended-choice-parameter-plugin/blob/master/src/main/java/com/cwctravel/hudson/plugins/extended_choice_parameter/ExtendedChoiceParameterDefinition.java#L427
// https://issues.jenkins-ci.org/browse/JENKINS-34617
@jgraglia
jgraglia / Dockerfile
Created March 24, 2016 09:28
Keepassx build
from ubuntu
RUN apt-get update && apt-get install -y wget build-essential cmake libqt4-dev libgcrypt11-dev zlib1g-dev
ENV VERSION 2.0.2
RUN wget https://www.keepassx.org/releases/$VERSION/keepassx-$VERSION.tar.gz
RUN wget https://www.keepassx.org/releases/$VERSION/keepassx-$VERSION.tar.gz.sig
RUN gpg --keyserver pgpkeys.mit.edu --recv-key 83135D45
RUN gpg --verify keepassx-$VERSION.tar.gz.sig keepassx-$VERSION.tar.gz
@jgraglia
jgraglia / dshark.sh
Created March 17, 2016 13:05
Docker : launch wireshark on a container
#https://github.com/crccheck/docker-tcpdump
#docker ps format help https://docs.docker.com/engine/reference/commandline/ps/#format
# IPT : https://github.com/ruyadorno/ipt
function dshark {
if [ $# == 0 ]; then
CONTAINER=`docker ps --format='table {{.ID}} | {{.Names}} | {{.Command}}' | ipt | cut -d '|' -f 1`
if [ "$$CONTAINER" == "" ]; then
echo "Missing docker container: $CONTAINER"
return 1
fi
@jgraglia
jgraglia / savestate.js
Created August 5, 2014 07:43
Datatables : save state in html5 local storage
datatable = $('#table').dataTable( {
"bStateSave": true,
// là suite est optionnelle. par défaut cookie, là on utilise localstorage html5
"fnStateSave": function(oSettings, oData) {
localStorage.setItem('DataTables_' + this.fnSettings().sTableId, JSON.stringify(oData));
},
"fnStateLoad": function (oSettings) {
return JSON.parse(localStorage.getItem('DataTables_' + this.fnSettings().sTableId));
}
....
@jgraglia
jgraglia / colstats_to_csv.js
Last active August 29, 2015 14:04
Mongo : export collections size to csv
// wget .... raw url ...
// mongo colstats_to_csv.js > `date +"%Y-%m-%d"`_stats.csv
rs.slaveOk();
print("db; col; total; storage; index; unused; unused KB; unused MB");
db._adminCommand("listDatabases").databases.forEach(function (d) {mdb = db.getSiblingDB(d.name); mdb.getCollectionNames().forEach(function(c) {idx = mdb[c].totalIndexSize(); s = mdb[c].storageSize(); t = mdb[c].totalSize(); print(d.name+"; "+c+"; "+t+";"+s+"; "+idx+"; "+(t-s-idx)+"; "+((t-s-idx)/1024)+"; "+((t-s-idx)/1024/1024));})})
@jgraglia
jgraglia / gist:7082840
Created October 21, 2013 12:09
Eclipse launcher for Ubuntu 13.10 gksu gedit /usr/share/applications/eclipse.desktop
[Desktop Entry]
#see https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1221848
Version=1.0
Name=Eclipse
Icon=/opt/eclipse/icon.xpm
Exec=env UBUNTU_MENUPROXY= /opt/eclipse/eclipse
# -consolelog -debug -verbose
StartupNotify=true
Terminal=false
Type=Application
@jgraglia
jgraglia / sample
Created March 25, 2013 07:57
Can't configure port of ldap-server of security namespace with a property : xml schema require a "xs:positiveInteger"
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
@jgraglia
jgraglia / tests.java
Created March 7, 2013 08:12
CloudSeal parse date of birth probleam
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import org.junit.Assert;
import org.junit.Test;
import com.cloudseal.client.saml2.CloudsealPrincipal;
@jgraglia
jgraglia / ordered_unpack_with_maven-assembly-plugin
Created November 28, 2012 21:20
ordered unpack with maven-assembly-plugin
Pour tester , changer l'odre des dependencySets
et regarder le contenu de target/trial-0.0.1-SNAPSHOT-orderedunpack/trial-0.0.1-SNAPSHOT/META-INF/MANIFEST.MF
POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>trial</artifactId>
assertSame(Float.NaN, Float.Nan)