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 | |
function errorMessage { | |
printf '%s\n' "Error: $1" >&2 | |
} | |
function message { | |
printf '%s\n' "$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
redis-cli --no-raw keys "exd:*" | perl -pe 's/^.*?[0-9]+\)/del/g' | redis-cli |
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
import {ReferenceInput} from 'admin-on-rest'; | |
export class ReferenceInputRequired extends ReferenceInput { | |
}; | |
ReferenceInputRequired.defaultProps = Object.assign({}, ReferenceInput.defaultProps); | |
ReferenceInputRequired.defaultProps.allowEmpty = true; | |
ReferenceInputRequired.defaultProps.validate = (value, _, props) => { | |
if (!value) { | |
return [props.translate("aor.validation.required")]; |
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 | |
# To add locally installed node.js binaries to $PATH | |
# Add the following code to your ~/.profile|~/.bash_profile|... | |
# If npm is available | |
if hash npm 2>/dev/null; then | |
# previously appended string | |
_NMB_PREVIOUS="" | |
_PREVIOUS_PATH="" | |
function addNodeModulesBinariesToPath() { |
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
find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n |
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
find . -name "*.log" -type f -exec egrep "event" {} \; | egrep -o "^[a-Z]+\s+[0-9]+" | sort | uniq -c | sort -n -k1 | tac |
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 | |
git commit "$@" | |
current=$(date +%s) | |
# Yesterday at 6pm UTC | |
start=$(($current - $current % 86400 - 3600 * 6)) | |
# Yesterday at midnight UTC | |
end=$(($current - $current % 86400)) | |
nextEnd=$(($end + 86399)) | |
commitDate=$(( $start + $(bc -l <<< "$(($current - $end))/$(($nextEnd - $end))*$(($end - $start))" | awk '{print int($1+0.5)}'))) | |
echo "$(date -r$start) < $(date -r$commitDate) < $(date -r$end)" |
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
function parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
NO_COLOUR="\[\033[0m\]" | |
PS1="$GREEN\u@\h$NO_COLOUR:\w$YELLOW\$(parse_git_branch)$NO_COLOUR\$ " |
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
lsof -i TCP -a -p <PID> |
NewerOlder