20 Agustus 2017

Copas Kilat

Copas Kilat

Beberapa copas yang sering digunakan
  • .bash_aliases
alias cl='clear'
alias h='history'
alias mv='mv -i'
alias rm='rm -i'
alias sss='. ~/.profile'
export EDITOR=/usr/bin/vi
export HISTSIZE=2000
export HISTFILESIZE=2000
  • .gitconfig
git config --global user.email        '66666666+cbkadal@users.noreply.github.com'
git config --global user.name         'Cicak BinKadal'
git config --global core.editor       'vi'
git config --global credential.helper 'cache --timeout=3600'
git config --global pull.rebase       'false'
git config --global init.defaultBranch master
cat $HOME/.gitconfig

  • shsh
#!/bin/bash  
# shsh:
# REV03: Sat 19 Nov 2022 12:00
# REV02: Fri 28 Apr 2017 19:00  
# REV01: Wed 28 Sep 2016 20:00  
# START: Wed 27 Jun 2012 00:00  
# Copyright (C) 2012-2022 BinKadal, Sdn.Bhd.

# This program is free script/ software. This program is distributed in the hope   
# that it will be useful, but WITHOUT ANY WARRANTY; without even the implied   
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

[ -f .shsh ] && {  
    /bin/bash .shsh $*  
    exit 0  
}  
echo "Where is the .shsh file???"  
exit 1

  • /etc/default/grub
GRUB_DEFAULT=saved 
GRUB_SAVEDEFAULT=true

  • GIT
#!/bin/bash
# REV19: Sat 19 Nov 2022 12:00
# REV11: Mon 25 Apr 2022 04:00
# REV10: Sun 18 Oct 2020 16:00
# REV09: Sat 06 Jul 2019 06:00
# REV03: Sun 07 Jan 2018 21:00
# START: Wed 10 Aug 2016 13:00

# Copyright (C) 2016-2022 BinKadal, Sdn.Bhd.
# This program is free script/software. This program is distributed in the hope 
# that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

XX="xx"

for ii in `ls` ;
do
   echo "XXXXXXXXXX XX XX XXXX $ii"
   cd $ii
   git ls-remote -q -h > /dev/null 2>&1
   [ "$?" != "0" ] && {
      echo -n "XXXXXXXXXX SLEEP 20 XX $ii"
      sleep 15
      git ls-remote -q -h > /dev/null 2>&1
      sleep 5
      echo  "OK"
      git ls-remote -q -h > /dev/null 2>&1
      [ "$?" != "0" ] && {
         echo "No $ii !!!!! !!!!!"
         exit 0
      }
   }
   sleep 2
   nice -15 git pull --all
   echo -n "2 "
   nice -15 git add -A
   nice -15 git commit -m "$HOSTNAME: $ii"
   sleep 2
   nice -15 git push --all
   echo "4 OK"
   [[ "$1" == "$XX" ]] && {
      echo -n "======================   ======================   $ii   "
      du -s -h . 
      git gc --prune=now --aggressive
      echo -n "======================   ======================   $ii   "
      du -s -h .
   }
   cd ..
done

exit 0

  • /etc/default/grub
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true


  • OOFFIC
#!/bin/bash
# ooffic
# REV04: Sat 16 Sep 2023 08:00
# REV03: Fri 28 Apr 2017 19:00
# START: Wed 27 Jun 2012 20:00
# Copyright (C) 2012-2023 BinKadal Sdn. Bhd

# This program is free script / software. This program is distributed in the 
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(libreoffice $* > /dev/null 2>&1) &

exit 0

  • FIXFS
#!/bin/bash
# fixfs: fixing file systems' name and mode
# REV09: Sat 16 Sep 2023 09:00
# REV08: Thu 30 Apr 2020 09:00
# REV07: Mon 02 Dec 2019 17:00
# REV06: Mon 24 Sep 2018 16:00
# REV05: Fri 08 Sep 2017 20:00
# START: Thu 19 Dec 2013 00:00

# Copyright (C) 2016-2023 BinKadal, Sdn.Bhd.
# This program is free script/software. This program is distributed in the hope 
# that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# Add escape \"
# Replacing all funny and white characters with a dash (-).
# Replacing multiple dashes (---) with a single dash (-)
# No dash before a dot.

function recursive() {
   ls -1 | mawk '{
      FNAME1=$0
      gsub (/\"/,"\\\"",FNAME1) 
      FNAME2=FNAME1
      NCHG=0
      NCHG += gsub (/[;:!() ^@&,\[\]\?\*\#\"\\'\'']/,"-",FNAME2) 
      NCHG += gsub (/\.-/,"-",FNAME2) 
      NCHG += gsub (/--+/,"-",FNAME2) 
      NCHG += gsub (/_-/,"-",FNAME2) 
      NCHG += gsub (/-_/,"-",FNAME2) 
      NCHG += gsub (/-\./,".",FNAME2) 
      NCHG += gsub (/\._/,"_",FNAME2) 
      NCHG += gsub (/__+/,"_",FNAME2) 
      NCHG += gsub (/_\./,".",FNAME2) 
      NCHG += gsub (/\.\.+/,".",FNAME2) 
      NCHG += gsub (/^-/,"",FNAME2) 
      NCHG += gsub (/-$/,"",FNAME2) 

      if (NCHG > 0) {
         EXTRA=""
         TMPF=FNAME2 EXTRA
         while ((getline < TMPF) >= 0) {
            EXTRA++
            TMPF=FNAME2 "-" EXTRA
         }
         system("/bin/mv -f \""  FNAME1  "\" " TMPF)
      }
   }'

   # chmod 755 for all directories
   # chmod 644 for all files
   for II in {.??,}*
   do
      [ -d "$II" ] && [ ! -L "$II" ] && {
         chmod 755 "$II"
         cd "$II"
         # Recursive inside the DIR
         recursive
         cd ..
      }
      [ -f "$II" ] && chmod 644 "$II"
   done
}

recursive

exit 0

  • .doBASH.sh
#!/bin/bash
# .doBASH.sh
# REV03: Sat 16 Sep 2023 09:00
# REV02: Tue 27 Jun 2023 15:00
# START: Fri 16 Jun 2023 16:00

# Copyright (C) 2023-2023 BinKadal, Sdn.Bhd.
# This program is free script/software. This program is distributed in the hope 
# that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

readlink -- /bin/sh
[[ "/bin/bash" == "/bin/bash" ]] || { /bin/rm -f /bin/sh; ln -s /bin/bash /bin/sh; }
readlink -- /bin/sh

exit 0

  • .doDNS.sh
#!/bin/bash
# .doDNS.sh
# REV04: Sat 16 Sep 2023 09:00
# REV04: Sun 10 Sep 2023 10:00
# REV03: Wed 16 Aug 2023 09:30
# REV02: Tue 27 Jun 2023 16:00
# START: Fri 16 Jun 2023 16:00

# Copyright (C) 2023-2023 BinKadal, Sdn.Bhd.
# This program is free script/software. This program is distributed in the hope 
# that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

RESOLV="/etc/resolv.conf"

echo   "===== $RESOLV was:"
cat    $RESOLV
cat >  $RESOLV <<< "nameserver 8.8.8.8"
cat >> $RESOLV <<< "nameserver 1.1.1.1"
cat >> $RESOLV <<< "nameserver 8.8.4.4"
echo   "===== $RESOLV now:"
cat    $RESOLV

exit 0

  • .doUPDATE.sh
#!/bin/bash
# .doUPDATE.sh
# REV02: Sat 16 Sep 2023 09:00
# REV01: Wed 16 Aug 2023 07:30
# START: Wed 16 Aug 2023 07:00

# Copyright (C) 2023-2023 BinKadal, Sdn.Bhd.
# This program is free script/software. This program is distributed in the hope 
# that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

time (
  aptitude update          &&
  echo " ===== 1 ====== "  &&
  aptitude safe-upgrade -y &&
  echo " ===== 2 ====== "  &&
  aptitude autoclean -y;
)

exit 0

  • .doZERO.sh
#!/bin/bash
# .doZERO.sh
# REV04: Sat 16 Sep 2023 09:00
# REV03: Sun 10 Sep 2023 15:00
# REV02: Tue 27 Jun 2023 16:00
# START: Fri 16 Jun 2023 16:00

# Copyright (C) 2023-2023 BinKadal, Sdn.Bhd.
# This program is free script/software. This program is distributed in the hope 
# that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rm -f /tmp/tmptmp
df -h /
dd if=/dev/zero of=/tmp/tmptmp bs=1M
df -h /
echo "==="
rm -f /tmp/tmptmp
df -h
sync

exit 0

  • GREP OSP

grep -Ev "::::::::::" <<< $(more Z03*/*/DW00/00*) | paste -d " " - -

  • XYZZY

A hollow voice says "Plugh".


DISCLAIMER


This is HOW Me Do IT! Grrr... this blog memo is mainly written for OWN PURPOSES. This post is based on "Google There, Google Here, Try That, Try This, Then Ask". Whether this is PLAGIARY or RESEARCH, there has never been a claim that this is an original work, nor is it necessarily the best solution, and not for Scopus consumption :). Please provide feedback, especially if you have alternative explanations. Hopefully, this note will be helpful in the future when you have forgotten how to solve this trivia problem.


DISKLAIMER


INIlah yang KUlakukan! Grrr... memo blog ini terutama ditulis untuk KEPERLUAN SENDIRI. Tulisan ini berbasis "Google Sana, Google Sini, Coba Itu, Coba Ini, Lalu Tanya-tanyi". Entah ini PLAGIAT, entah ini RISET, yang jelas tidak pernah ada klaim bahwa ini merupakan karya asli, serta belum tentu pula merupakan solusi terbaik, serta bukan untuk konsumsi Scopus :). Mohon kiranya memberikan tanggapan, terutama jika memiliki solusi alternatif. Semoga catatan ini akan bermanfaat di masa mendatang, saat sudah lupa cara menyelesaikan masalah trivia ini.

Qapla!

Tidak ada komentar:

Posting Komentar