This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Git-flow release automation with | |
# version bumping and changelog generation | |
# | |
# Based on many great starting points: | |
# https://gist.github.com/mareksuscak/1f206fbc3bb9d97dec9c | |
# https://gist.github.com/pete-otaqui/4188238 | |
# https://gist.github.com/bclinkinbeard/1331790 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getUserIpAddr() { | |
if(!empty($_SERVER['HTTP_CLIENT_IP'])){ | |
return $_SERVER['HTTP_CLIENT_IP']; | |
} | |
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ | |
return $_SERVER['HTTP_X_FORWARDED_FOR']; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Truncate Traefik high volume log | |
# CRONTAB: 0 */2 * * * /root/scripts/traefik-truncate-log.sh > /dev/null 2>&1 | |
TRAEFIK=$(docker ps --no-trunc | grep 'traefik' | awk '{ print $1 }'); | |
TRAEFIK_PATH="/var/lib/docker/containers/$TRAEFIK/"; | |
/usr/bin/find "$TRAEFIK_PATH" -type f \( -name "*-json.log" \) -size +5M -exec bash -c 'echo "" > "$1"' _ {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
STORE_PASS=changeit | |
JAVA_HOME=${1-text} | |
[ $# -eq 0 ] && { echo "Usage: sudo $0 \$(/usr/libexec/java_home -v '1.8*')" ; exit 1; } | |
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run these as root or prefix with sudo on the Docker host machine | |
# $MACHINE = Container ID, or part of it. | |
# Usually 3 first chars are enough. Get it with `docker ps|grep mssql-server` | |
# Create backup folder | |
docker exec -it $MACHINE mkdir /var/opt/mssql/backup | |
# Copy backups to the machine | |
docker cp backup.bak $MACHINE:/var/opt/mssql/backup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in terminal write the following lines, | |
# after the last just push enter twice. | |
git credential-osxkeychain erase | |
host=bitbucket.org | |
protocol=git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// From 20190122-124559 to 2019-01-22 12:45:59 | |
$patterns = '/(19|20)(\d{2})(\d{1,2})(\d{1,2})-(\d{1,2})(\d{1,2})(\d{1,2})/'; | |
$replace = '\1\2-\3-\4 \5:\6:\7'; | |
$date = preg_replace($patterns, $replace, $date); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for image in $(/usr/bin/docker images -q -f dangling=true); | |
do | |
/usr/bin/docker rmi $image; | |
done | |
for volume in $(/usr/bin/docker volume ls -qf dangling=true); | |
do | |
/usr/bin/docker volume rm $volume; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Swapfile generator | |
# | |
# Copyright 2019 Ismo Vuorinen <[email protected]> | |
# Licensed under MIT <https://opensource.org/licenses/MIT> | |
_err () { | |
echo "(!) Error: $1" >&2; exit 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove files from your specified path. | |
git filter-branch --force --index-filter 'git rm --cached -r --ignore-unmatch dir/with/large/files/*' --prune-empty --tag-name-filter cat -- --all | |
rm -rf .git/refs/original/ && git reflog expire --expire=now --all && git gc --prune=now && git gc --aggressive --prune=now |