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
const hasDuplicate = <T,>(items: T[], func: (a: T, b: T) => boolean = (a, b) => a === b): boolean => { | |
return items.find((item, idx) => items.some((item2, idx2) => func(item, item2) && idx !== idx2)) != null; | |
}; |
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 | |
for cmd in docker jq; do | |
if ! command -v ${cmd} > /dev/null; then | |
echo "Error: ${cmd} is required." 1>&2 | |
exit 1 | |
fi | |
done | |
COMPOSE_FILE="$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 | |
for cmd in docker curl jq; do | |
if ! command -v ${cmd} > /dev/null; then | |
echo "Error: ${cmd} is required to setup docker compose plugin." 1>&2 | |
exit 1 | |
fi | |
done | |
DOCKER_COMPOSE="${HOME}/.docker/cli-plugins/docker-compose" |
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 | |
REQUIRED_COMMANDS=("skopeo" "jq" "basename") | |
for COMMAND in "${REQUIRED_COMMANDS}"; do | |
if ! command -v ${COMMAND} > /dev/null; then | |
echo "Error: ${COMMAND} command is required." 1>&2 | |
exit 2 | |
fi | |
done |
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 | |
# VERSION:20211203 | |
_uid=$(id -u) | |
if test $_uid -ne 0; then | |
echo "Error : This script have to run as root" | |
exit 1 | |
fi |
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 | |
declare(strict_types=1); | |
$config = new PhpCsFixer\Config(); | |
return $config | |
->setRiskyAllowed(true) | |
->setRules([ | |
'@Symfony' => true, |
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 | |
DEVICE=$1 | |
ip addr show dev ${DEVICE} | sed -e 's/^.*inet6 \([^ ]*\)\/.*scope global.*$/\1/;t;d' |
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 | |
SERVICE_NAME=postfix | |
SERVICE_DOMAINS=example.com | |
IS_ACTIVE=$(systemctl is-active ${SERVICE_NAME}) | |
if [ "${IS_ACTIVE}" != "active" ]; then | |
exit 0 | |
fi |
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
bindkey '^P' history-search-backward | |
bindkey '^N' history-search-forward |
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 | |
export LANG=C | |
BACKUPDIR=/backup/daily | |
DATE=`date` | |
if test ! -d $BACKUPDIR; then | |
mkdir -p $BACKUPDIR | |
chmod 700 $BACKUPDIR |
NewerOlder