Skip to content

Instantly share code, notes, and snippets.

View SultanICQ's full-sized avatar
🚀
Improving myself

David Garcia SultanICQ

🚀
Improving myself
View GitHub Profile
@SultanICQ
SultanICQ / AwsFeignClient.kt
Created November 19, 2025 09:14
Send dynamic Accept header via Spring Cloud Feign
const val DEFAULT_AWS_CONTENT_TYPE = "application/json"
@FeignClient
interface AwsFeignClient {
@PostMapping(path = ["/"])
fun actionCreateTaskStep(
@RequestHeader(HttpHeaders.ACCEPT)
acceptedContentType: String = DEFAULT_AWS_CONTENT_TYPE,
@RequestBody
request: ActionRequest,
@SultanICQ
SultanICQ / list-commits.sh
Last active December 19, 2024 09:39
Script that goes through all the subfolders of the specified folder and displays the commits made by the user and specified dates.
#!/bin/bash
need_cmd() {
if ! check_cmd "$1"
then err "[command not found '$1' - please install this command]"
fi
}
check_cmd() {
command -v "$1" > /dev/null 2>&1
@SultanICQ
SultanICQ / .htaccess-multiple-slashes-fix
Created December 3, 2020 13:03
htaccess multiple slashes in url fix
RewriteEngine On
# We detect the duplicate bars and save the url to eliminate
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{ENV:FixDoubleSlashes} !=1
RewriteCond %{THE_REQUEST} ^(?:GET|HEAD|POST)\s(.*?//+.*)\s
RewriteRule . - [E=FixDoubleSlashes:1,E=RewriteUrl:%1,N]
# We eliminate the double bars recursively
RewriteCond %{ENV:FixDoubleSlashes} =1
@SultanICQ
SultanICQ / watch-apache2-config.sh
Created June 23, 2020 06:12
Restart Apache2 on configuration file modification
#!/bin/bash
iwatch -v -c 'apache2ctl restart' redirect.conf
@SultanICQ
SultanICQ / remote-xdebug.sh
Created April 23, 2020 10:30
Connect back xDebug via SSH on remote port 9000 with our local port 9000
ssh -R 9000:localhost:9000 sshuser@ssh.host.org
@SultanICQ
SultanICQ / remove-all-docker-containers.sh
Created October 7, 2019 05:25
Remove Docker containers & images
#!/bin/bash
docker rm -vf $(docker ps -a -q)
@SultanICQ
SultanICQ / restart-osx-sound-system.sh
Created September 9, 2019 18:12
Restart Sound System Mac
#!/bin/bash
sudo kill -9 `ps ax|grep 'coreaudio[a-z]' | awk '{print $1}'`
@SultanICQ
SultanICQ / verify-final-redirect.sh
Last active July 22, 2019 14:00
Bash script to check if an url is redirected to the final url that we wanted.
#!/bin/bash
ORIGIN=$1
FINAL=`curl "$ORIGIN" -sLIk -o /dev/null -w '%{url_effective}'`
EXPECTED=$2
if [ "$FINAL" == "$EXPECTED" ]
then
echo "Ok"
exit 0
fi
@SultanICQ
SultanICQ / check-redirect.sh
Last active July 22, 2019 13:23
Code to show the status and redirections of a given url
#!/bin/bash
curl -kILSs "$1" | grep "[Ll]ocation\|HTTP"