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 | |
... | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ |
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/perl | |
# | |
#==================================================== | |
# | |
# Stand in for docker-compose 'extends' and env replacement | |
# ( currently not implemented for `docker stack deploy -f` ) | |
# | |
#==================================================== | |
use strict; |
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
func ComputeHmac256(message string, secret string) string { | |
key := []byte(secret) | |
h := hmac.New(sha256.New, key) | |
h.Write([]byte(message)) | |
return base64.StdEncoding.EncodeToString(h.Sum(nil)) | |
} |
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 | |
# ensure running bash | |
if ! [ -n "$BASH_VERSION" ];then | |
echo "this is not bash, calling self with bash...."; | |
SCRIPT=$(readlink -f "$0") | |
/bin/bash $SCRIPT | |
exit; | |
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
#!/bin/bash | |
set -euo pipefail | |
mkdir -p ./out | |
rm -rf ./out/prod_split_* | |
csplit -n2 -s -f "out/" -b "prod_split_%d" $1 "/-- Database: /-1" "{*}" | |
rm -f ./out/prod_split_0 | |
cd ./out |
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
# Add this to your bashrc/zshrc somewhere | |
# Set env FR_SEARCH_PATH to where you want fr to start looking from, otherwise it starts at current dir. | |
function fd() { | |
local startDir=${FR_SEARCH_PATH:=.} | |
local dir | |
dir=$(cd $startDir && find . -name *.git -type d -nowarn 2>/dev/null | sed 's/\(.*\)\/.git/\1/' | fzf) && cd "$startDir/$dir" | |
} |
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
cfg.parser () { | |
fixed_file=$(cat $1 | sed 's/ = /=/g') # fix ' = ' to be '=' | |
IFS=$'\n' && ini=( $fixed_file ) # convert to line-array | |
ini=( ${ini[*]//;*/} ) # remove comments | |
ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix | |
ini=( ${ini[*]/%]/ \(} ) # convert text2function (1) | |
ini=( ${ini[*]/=/=\( } ) # convert item to array | |
ini=( ${ini[*]/%/ \)} ) # close array parenthesis | |
ini=( ${ini[*]/%\( \)/\(\) \{} ) # convert text2function (2) | |
ini=( ${ini[*]/%\} \)/\}} ) # remove extra parenthesis |
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 -euo pipefail | |
function useDockerEnv { | |
eval "$(docker-machine env $1)" | |
} | |
function getIfaceIP { | |
local machine="$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
func staticDockerPortMapper(){ | |
[[ $# -lt 3 ]] && >&2 echo "usage: $0 <container-name/id> <exposed-container-port>/<tcp|udp> <static-port>" && return | |
local container=$1 | |
local internalPort=$2 | |
local staticPort=$3 | |
local currentPid=$(lsof -ti :$staticPort 2>/dev/null) | |
if [[ -n $currentPid ]] | |
then |
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
RED=`echo -e '\033[101m\033[37m'` | |
GREEN=`echo -e '\033[102m'` | |
DARK_RED=`echo -e '\033[41m\033[37m'` | |
DARK_GREEN=`echo -e '\033[42m'` | |
NORMAL=`echo -e '\033[0m'` | |
#Docker aliases | |
function dps(){ | |
docker ps --format "{{.ID}}\t{{.Image}}\t{{.Labels}}"| \ | |
sed -e "s/:/ :/" | \ |