Skip to content

Instantly share code, notes, and snippets.

View arturozv's full-sized avatar

Arturo Zendrera Valsecchi arturozv

View GitHub Profile
@arturozv
arturozv / wow.json
Created September 28, 2024 19:45
MacOS - Switch keys for a single application (World of Warcraft)
{
"title": "Swap Left Option/Command only in WoW",
"rules": [
{
"description": "Left Option to Command in WoW",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_option"
@arturozv
arturozv / build.gradle
Created May 13, 2016 10:47
Aggregated Jacoco reports in a multi-project Gradle build
allprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
repositories {
jcenter()
}
jacoco {
toolVersion = '0.7.1.201405082137'
@arturozv
arturozv / bot.py
Created April 16, 2016 00:05
Testing telegram bots
#https://github.com/eternnoir/pyTelegramBotAPI
#pip install pyTelegramBotAPI
import telebot
from telebot import types
import time
TOKEN = '208043687:AAFK9Acv9mo8psa-z8oB4Hf9RiDprjgUn7s'
bot = telebot.TeleBot(TOKEN)
@arturozv
arturozv / gitlabssl.sh
Last active November 11, 2015 13:15
Ubuntu -> update gitlab ssl certificates
echo -n | openssl s_client -connect gitlab.com:443 | \
sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | \
sudo tee '/usr/local/share/ca-certificates/gitlab_com.crt'
sudo update-ca-certificates
@arturozv
arturozv / gist:f9084111bb3365dc0f5d
Created June 11, 2015 07:48
Spring data mongodb custom auditing with AbstractMongoEventListener
import org.joda.time.Instant;
import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener;
public class MongoSynchronizedListener extends AbstractMongoEventListener<Object> {
/**
* Called in MongoTemplate insert, insertList and save operations before the
* object is converted to a DBObject using a MongoConveter.
*/
#!/bin/bash
# ./backup.sh pro databaseName
# Validations
if [ -z "$1" ] ; then
echo `date`" specify a environment ['tst', 'pro']"
exit 1
elif [ "$1" != "tst" ] && [ "$1" != "pro" ]; then
echo `date`" specify a valid environment ['tst', 'pro']"
exit 1
#!/bin/bash
# Params:
# 1- filename in s3. Ex: mongobackup-tst-28-05-2015-1432802174.7z
# 2- source env. Ex: pro
# 3- target env to restore in. Ex: tst
# 4- target database name. Ex: databaseRestore
# ex: ./restore.sh mongobackup-tst-28-05-2015-1432802174.7z pro tst databaseRestore
# s3 file exists and ends with .tar.gz
if [ -z "$1" ] || [[ ! $1 =~ .*.7z ]]; then
import com.google.common.cache.Cache;
import com.google.common.cache.CacheStats;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.PublicMetrics;
import org.springframework.boot.actuate.metrics.Metric;
import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import java.util.ArrayList;
@arturozv
arturozv / gist:35d248ca14927196ab56
Created May 12, 2015 14:33
Spring mvc message converter configuration with jackson
package com.shootr.api.config;
import java.util.List;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@arturozv
arturozv / gist:6df2355a33d44998e8de
Created May 12, 2015 14:32
Spring @ControllerAdvice to handle exceptions
package com.shootr.api.web.rest.exception;
import java.util.ArrayList;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;