Notes
  • Blockchain
  • About this repository
  • References
  • Carret Position
  • Loggia and Balcony
  • automobile
    • Motorbike
  • computer
    • Kubernetes Event-driven Autoscaling (KEDA)
    • Protobuf
    • [[Amazon]] [[Identity and Access Management]] ([[IAM]])
    • Apdex
    • Architecture Decision Record
    • Audio
    • [[Amazon Web Services]] (AWS) Lambda
    • Blockchain
    • C/C++
    • Cache line
    • Caching strategies
    • Database
    • Design Patterns
    • Docker compose
    • Event Driven Design
    • False sharing
    • Git
    • [[Go]] common mistakes
    • [Go] [[subtests]]
    • Go
    • Janus
    • Jest
    • Kubernetes
    • Log-Structured Merge-tree
    • Media server
    • MySQL: Charset, Collation and UCA
    • Netflix
    • Opus Codec
    • Process, Thread
    • ReDoS - [[Regular expression]] Denial of Service
    • Rust
    • ScyllaDB
    • Shell Functions
    • Signals (The GNU Library)
    • Solidity
    • Sources
    • SQL
    • Transmission Control Protocol (TCP)
    • Ten design principles for Azure applications
    • Transient Fault Handling
    • twemproxy
    • Video
    • Web2 vs Web3
    • WebRTC
    • Microservice architecture
      • 3rd party registration
      • Command Query Responsibility Segregation (CQRS)
      • Access token
      • Aggregate
      • API Composition
      • API gateway/Backends for Frontends
      • Application metrics
      • Audit logging
      • Circuit Breaker
      • Client-side discovery
      • Client-side UI composition
      • Consumer-driven contract test
      • Consumer-side contract test
      • Database per Service
      • Decompose by business capability
      • Decompose by subdomain
      • Distributed tracing
      • Domain event
      • Domain-specific
      • Event sourcing
      • Exception tracking
      • Externalized configuration
      • Health check API
      • Log aggregation
      • Log deployments and changes
      • Messaging
      • Microservice architecture
      • Microservice Chassis
      • Multiple Service instances per host
      • Polling publisher
      • Remote Procedure invocation
      • Saga
      • Self-contained service
      • Self registration
      • Server-side discovery
      • Server-side page fragment composition
      • Serverless deployment
      • Service Component test
      • Service deployment platform
      • Service instance per Container
      • Service instance per VM
      • Service mesh
      • Service per team
      • Service registry
      • Service template
      • Shared database
      • Single Service instance per host
      • Transaction log tailling
      • Transactional outbox
  • food-and-beverage
    • Cheese
    • Flour
    • Japanese Plum liqueur or Umeshu
    • Sugar
  • management
    • Software Engineering processes
  • medic
    • Desease, disorder, condition, syndrome
    • Motion Sickess
  • others
    • Elliðaey
    • ASCII art
    • Empirical rule
    • Hindsight bias
    • Outcome bias
    • Tam giác Reuleaux
    • Luật Việt Nam
  • soft-skills
    • Emotional intelligence
Powered by GitBook
On this page
  • Ubuntu
  • MacOS
  • Functions
  1. computer

Shell Functions

Ubuntu

Require: figlet, run sudo apt-get install figlet

Edit your ~/.profile file

MacOS

Require: figlet, run brew install figlet

Should create and .zsh_functions file and add function into that file. In .zshrc add source ~/.zsh_functions.

Functions

git-co() {
    figlet "Checkout all" 
    if [ -z "$1" ]; then
        dir=$(pwd)
    else
        dir="$1"
    fi
    for i in $(find "$dir" -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev); do
        echo "════════════════════════════════════════════════════════════════════════════════════════════════════════"
        echo "Directory: $i | Branch: $2"
        git -C "$i" checkout "$2"
        echo "────────────────────────────────────────────────────────────────────────────────────────────────────────\n"
    done
}
git-reset() {
    figlet "Reset all"
    if [ -z "$1" ]; then
        dir=$(pwd)
    else
        dir="$1"
    fi
    for i in $(find "$dir" -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev); do
        echo "════════════════════════════════════════════════════════════════════════════════════════════════════════"
        echo "Directory: $i | Branch: $(git -C "$i" rev-parse --abbrev-ref HEAD) | Mode: $2"
        git -C "$i" reset "$2"
        echo "────────────────────────────────────────────────────────────────────────────────────────────────────────\n"
    done
}
git-pull() {
    figlet "Pull all"
    if [ -z "$1" ]; then
        dir=$(pwd)
    else
        dir="$1"
    fi
    for i in $(find "$dir" -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev); do
        echo "════════════════════════════════════════════════════════════════════════════════════════════════════════"
        echo "Directory: $i | Branch: $(git -C "$i" rev-parse --abbrev-ref HEAD)"
        git -C "$i" pull
        echo "────────────────────────────────────────────────────────────────────────────────────────────────────────\n"
    done
}
git-sync() {
    figlet "Sync all"
    if [ -z "$1" ]; then
        dir=$(pwd)
    else
        dir="$1"
    fi
    for i in $(find "$dir" -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev); do
        echo "════════════════════════════════════════════════════════════════════════════════════════════════════════"
        echo "Directory: $i | Branch: $(git -C "$i" rev-parse --abbrev-ref HEAD)"
        remote=origin; for brname in `git -C "$i" branch -r | grep $remote | grep -v master | grep -v HEAD | awk '{gsub(/^[^\/]+\//,"",$1); print $1}'`; do
            git -C $i branch --track $brname $remote/$brname || true;
            git -C $i checkout $brname && git -C $i pull;
        done
        echo "────────────────────────────────────────────────────────────────────────────────────────────────────────\n"
    done
}
trivyscan() {
    docker run --rm -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy:latest image --no-progress --exit-code 1 --no-progress --severity CRITICAL $1
}
git-set-personal() {
    echo "Set git user to giaduongducminh@gmail.com"
    git config --local user.name "Giã Dương Đức Minh"
    git config --local user.email "giaduongducminh@gmail.com"
}
PreviousScyllaDBNextSignals (The GNU Library)

Last updated 2 years ago