Skip to content

Instantly share code, notes, and snippets.

View NicolasGeraud's full-sized avatar

Nicolas Géraud NicolasGeraud

View GitHub Profile
#!python2
# -*- coding:utf-8 -*-
import getopt
import sys
import glob
import os
import os.path
import hashlib
workdir = None
@NicolasGeraud
NicolasGeraud / generate_hash_3.py
Last active January 9, 2018 21:37
generate md5 and sha1 for all zip in a directory
#!python3
# -*- coding:utf-8 -*-
import getopt
import sys
import glob
import os.path
import hashlib
workdir = None
<?xml version="1.0" encoding="UTF-8"?>
<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>io.gravitee</groupId>
<artifactId>download</artifactId>
<version>1.0-SNAPSHOT</version>
@NicolasGeraud
NicolasGeraud / DynamicProperties.json
Last active February 3, 2021 22:17
transform.json
[
{
"operation": "shift",
"spec": {
"components": {
"*": {
"name": "[&1].key",
"version": "[&1].value"
}
}
docker run -p 9300:9300 \
-p 9200:9200 \
-e "http.host=0.0.0.0" \
-e "transport.host=0.0.0.0" \
-e 'xpack.security.enabled=false' \
-e 'xpack.monitoring.enabled=false' \
-e 'cluster.name=elasticsearch' \
-d \
--name es5 \
docker.elastic.co/elasticsearch/elasticsearch:5.4.1
@NicolasGeraud
NicolasGeraud / create.admin.roles.if.not.exists.js
Created July 19, 2017 19:36
Create admin role id not exists (migration from 1.7 to 1.8)
var now = new Date();
db.users.find().forEach(
function(user) {
if (user._id === "admin") {
print("admin found")
var exists = db.memberships.find({_id: { userId : "admin", referenceId : "DEFAULT", referenceType : "MANAGEMENT"}}).count() > 0;
print("Does admin already has new memberships? " + exists)
if (!exists) {
db.memberships.insert([
{
@NicolasGeraud
NicolasGeraud / sync.sh
Last active January 7, 2017 09:38
sync graviteeio repositories and update master and run maven
for f in *;do if [[ -d $f ]]; then pushd $f 2>&1 1>/dev/null; echo "\n====== $f" && gfa && gco master && gm; popd 2>&1 1>/dev/null; fi; done;
for f in *;do if [[ -d $f ]]; then pushd $f 2>&1 1>/dev/null; if [[ -e "pom.xml" ]]; then echo "\n====== $f" && mvnci; fi; popd 2>&1 1>/dev/null; fi; done;
git filter-branch -f --env-filter '
LANG=en_US.utf8
original_git_date="$GIT_COMMITTER_DATE"
cutDate=$(echo $original_git_date | rev | cut -d" " -f2 |rev)
hour=$(date --date "$cutDate" +%H)
day=$(date --date "$cutDate" +%u)
new_git_date=$(date --date "$cutDate" +"%a %b %d %T %Y")
if [ "$hour" -gt "9" ] && [ "$hour" -lt "19" ] && [ "$day" -lt "6" ]
then
new_git_date=$(date --date "$new_git_date 9 hours" +"%a %b %d %T %Y %z")
@NicolasGeraud
NicolasGeraud / list_jenkins_cron.groovy
Created March 18, 2016 13:42
lister tous les cron des jobs jenkins
for (item in Jenkins.instance.items) {
if ( ! item.disabled ) {
for( trigger in item.triggers) {
if(trigger.value.spec != "") {
println "${item.name} ${trigger.value.spec}"
}
}
}
}
@NicolasGeraud
NicolasGeraud / sync_graviteeio_repo.py
Last active July 16, 2016 10:05
clone or fetch all Gravitee.io repositories.
import subprocess
import requests
import os
import sys
if len(sys.argv) < 2:
print("")
print("Usage: sync_gravitee.py [https | ssh]")
print(" clone mode : https or ssh")
sys.exit(1)