Skip to content

Instantly share code, notes, and snippets.

@dominictarr
dominictarr / handle_the_jandal.js
Created October 20, 2010 12:06
ways to process errors in node js
//test-uncaught-errors
var sys = require('sys')
, EventEmitter = require('events').EventEmitter;
function error1 (err){
sys.puts("Handle: " + err);
}
function error2 (err){
sys.puts("JANDAL: " + err);
}
function exit (){
@tacsio
tacsio / Git Configs
Last active September 15, 2022 01:10
My git config
git config --global user.name "Tarcisio Coutinho"
git config --global user.email "tcs5cin@gmail.com"
git config --global color.ui true
git config --global alias.s status
git config --global alias.c checkout
git config --global alias.b branch
git config --global alias.lol log --oneline --graph --decorate
# <tipo>(escopo): assunto
# If applied, this commit will...
# <corpo>
# Why was this change made?
#<rodapé>
# Relevant tickets, articles or other resources
@rponte
rponte / Cliente.java
Last active October 14, 2020 02:35
Injecting @Autowired dependencies into self-instantiated objects with Spring
@Entity
@EntityListeners(RepositoryAwareListener.class)
public class Cliente {
@Autowired // that's important!
private transient ClienteRepository repository;
// atributos da entidade
public List<Orcamento> orcamentosAPartirDeDeterminadoAno(int ano){
@frankrausch
frankrausch / change-speed-of-mp3.sh
Last active April 21, 2024 07:06
Slow down or speed up all MP3 files in a folder with FFmpeg.
#/bin/sh
speed="0.7"
mkdir "speed-${speed}x"
for f in *.mp3
do ffmpeg -i "$f" -filter:a "atempo=${speed}" "./speed-${speed}x/$f"
done
@zoilomora
zoilomora / README.md
Last active June 28, 2024 04:59
How to disable cloud-init in Ubuntu

How to disable cloud-init in Ubuntu

Prevent start

  • Create an empty file to prevent the service from starting

      sudo touch /etc/cloud/cloud-init.disabled
    

Uninstall

@agrawald
agrawald / config.java
Created August 28, 2019 00:41
Spring-boot: RestTemplate: Reading Response Body multiple times
@Bean
public RestTemplate restTemplate(final LauHeaderInterceptor lauHeaderInterceptor) {
final RestTemplate restTemplate = new RestTemplate();
restTemplate.setMessageConverters(Collections.singletonList(new MappingJackson2HttpMessageConverter()));
restTemplate.setErrorHandler(new ResponseErrorHandler() {
@Override
public boolean hasError(final ClientHttpResponse response) throws IOException {
return false;
}
@caseywatts
caseywatts / 0-self-publishing.md
Last active June 4, 2024 20:23
Self-Publishing via Markdown
@kekbur
kekbur / CSRFFilter.java
Last active March 10, 2022 21:29
Quarkus CSRF token filter
/**
* The MIT License
* Copyright (c) 2020 kekbur
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.time.LocalDate;
import javax.ws.rs.ext.ParamConverter;
import javax.ws.rs.ext.ParamConverterProvider;
import javax.ws.rs.ext.Provider;
@Provider
public class LocalDateParamConverterProvider implements ParamConverterProvider {