Skip to content

Instantly share code, notes, and snippets.

View mageddo's full-sized avatar
💭
🚲 🍺

Elvis Souza mageddo

💭
🚲 🍺
View GitHub Profile
@mageddo
mageddo / script.sh
Last active January 1, 2020 17:15
Convert multiple videos inside dir
set -e
export AV_LOG_FORCE_NOCOLOR=1 &&\
FILES_TO_CONVERT="$(ls *.mp3)" &&\
TOTAL=$(echo "$FILES_TO_CONVERT" | wc -l) &&\
I=0 &&\
OUT_DIR=converted && mkdir -p ${OUT_DIR} &&\
(IFS='
'
for IN in $FILES_TO_CONVERT; do
@mageddo
mageddo / Main.java
Last active August 6, 2019 00:45
OkHTTP Client Example
import com.mageddo.portainer.client.apiclient.PortainerAuthenticationFilter;
import com.mageddo.portainer.client.apiclient.PortainerStackApiClient;
import okhttp3.ConnectionPool;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) {
@mageddo
mageddo / Main.java
Created March 27, 2019 18:39
Kafka Round Robin
static class Partition {
int partition;
int count;
public Partition(int partition) {
this.partition = partition;
this.count = 0;
}
public int getCount() {

I think you are looking for [8.3 Flexible layouts][1] The documantation is awesome and easy to follow, but here is also simple case for just inserting title string

layouts/layout.html

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:fragment="page(title)">
    <head th:replace="fragments/head :: common_header(title=${title})"></head>
    <body>
        <div th:replace="this :: content"></div>
@mageddo
mageddo / JavacMultilineProcessor.java
Created February 25, 2019 02:15
JavaParserSamples
// java parser 3.13 java 8+
package com.mageddo.rawstringliterals;
import com.github.javaparser.JavaParser;
import com.github.javaparser.JavaParserBuild;
import com.github.javaparser.ParserConfiguration;
import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Node;
<?xml version="1.0"?>
<ruleset name="myruleset">
<description>My ruleset</description>
<rule ref="category/java/bestpractices.xml" />
<rule ref="category/java/codestyle.xml" >
<exclude name="AtLeastOneConstructor" />
<exclude name="MethodArgumentCouldBeFinal" />
<exclude name="LocalVariableCouldBeFinal" />
<exclude name="DefaultPackage" />
@mageddo
mageddo / README.md
Created January 27, 2019 15:08
Multiline Commands On Docker Compose
$ docker-compose -f my-stack.yml run docker
Hello World
Sun Jan 27 15:07:48 UTC 2019
@mageddo
mageddo / README.md
Created January 27, 2019 15:03
Customize stack command without need to duplicate service
CMD=ls docker stack deploy --prune -c stack.yml my-stack
@mageddo
mageddo / README.md
Created January 27, 2019 14:54
Broadcast command across all nodes on swarm cluster

Broadcast command across all nodes

$ BUILD_NUMBER=2 docker stack deploy --prune -c my-stack.yml docker

Checking command output

$ docker service logs docker_docker 
docker_docker.0.x9u2y9noipp5@typer-pc | docker_docker.kumhjmhzm046qoje5akk9c80a.x9u2y9noipp5biihrmu0xdonk
$ ansible-playbook -i hosts -c local playbook.yml 

PLAY [main[0]] *******************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
ok: [127.0.0.1]

TASK [command] *******************************************************************************************************************************************************************************************************************************
changed: [127.0.0.1]