Skip to content

Instantly share code, notes, and snippets.

@MFrancesco
MFrancesco / .bash_aliases
Last active October 12, 2022 11:33
My bash_aliases file containing some useful functions
#Check if the commit is ok
function checkCommit() {
sbt fixAndFormat && sbt test && sbt it:test
if ! $?;
then echo "KO - Build failed"
else echo "OK - You can now push"
fi
}
function dockerStopAll() {
@MFrancesco
MFrancesco / TestFluxApplication.java
Created October 27, 2021 15:40
Use spring flux to monitor a submitted job, asynchronous server-to-client communication about the status of the job submitted
import java.time.Duration;
import java.util.stream.IntStream;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;
@MFrancesco
MFrancesco / exec_benchmark.sh
Created May 17, 2019 10:16
Script to execute GeekBench
cd /tmp
wget http://cdn.geekbench.com/Geekbench-4.2.2-Linux.tar.gz
tar -zxvf Geekbench-4.2.2-Linux.tar.gz
cd Geekbench-4.2.2-Linux
./geekbench_x86_64
@MFrancesco
MFrancesco / server.properties
Created January 25, 2019 09:35
kafka and zookeeper properties files for a 3 node cluster
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@MFrancesco
MFrancesco / Centos_basic_iptables
Last active January 24, 2019 16:37
Basic centos iptables security script
yum install -y iptables-services
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -X
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
@MFrancesco
MFrancesco / kafka.service
Created January 24, 2019 14:29
systemd service file for kafka installed under /opt/kafka
[Unit]
Requires=zookeeper.service
After=zookeeper.service
[Service]
Type=simple
User=kafka
ExecStart=/bin/sh -c '/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties > /opt/kafka/kafka.log 2>&1'
ExecStop=/opt/kafka/bin/kafka-server-stop.sh
Restart=on-abnormal
@MFrancesco
MFrancesco / zookeeper.service
Last active January 24, 2019 16:24
systemd service file for Zookeeper instance for kafka installed under /opt/kafka
[Unit]
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
User=kafka
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal
@MFrancesco
MFrancesco / zookeeper.service
Created January 24, 2019 14:24
Zookeeper service systemd file
[Unit]
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
User=kafka
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal
@MFrancesco
MFrancesco / minio_client_installation.sh
Last active September 21, 2016 11:19
I've just installed https://www.minio.io/ under our company's server, is cool. Once your minio server is started just fill the configuration and distribute the script to your coworkers.
#!/bin/bash
#SETUP CONFIGURATION
ALIAS=
#S3/Minio endpoint, including port if needed
S3_ENDPOINT=
ACCESS_KEY=
SECRET_KEY=
#API signature, if needed
API_SIGNATURE=
#-----------------------------------------------------------------------#
# #
# MANDATORY Configurations #
# #
#-----------------------------------------------------------------------#
#Absolute path of the directory where spark_submit shell script is located
SPARK_SUBMIT_PATH=
#Absolute path of the maven project