From Bitty Hedgehog, 3 Weeks ago, written in Plain Text.
  1. #!/bin/bash
  2. # Call TRROOOOOGDDOOOOOOOOORRRrrrrrrrrRR to burninate and killamastab
  3. # anything that goes mad and eats 100% proc or spikes temps to 95c
  4.  
  5. shopt -s expand_aliases
  6.  
  7.  
  8. [[ "$1" == "-d" ]] && DEBUG=1 && shift
  9. [[ "$1" == "---TROOOGDOOOORR" ]] && LOoUUD="yes" || LOoUUD="no"
  10.  
  11. usage(){ printf "$0 [-d|-h]" ;}
  12. speak(){ printf "$@" ;}
  13. scream(){ printf "$@" >&2;}
  14. bail(){ scream "$@"; usage >&2; exit 1;}
  15.  
  16. cpuload(){
  17.   oldidle="$(awk '{print $1*100}' /proc/uptime)"
  18.   old="$(awk -v idl="${oldidle}" '{ORS=":";if($1~/cpu[0-9]/) print $2+$4+idl+$6}' /proc/stat)"
  19.   sleep 1s
  20.   newidle="$(awk '{print $1*100}' /proc/uptime)"
  21.   new="$(awk -v idl="${newidle}" '{ORS=":";if($1~/cpu[0-9]/) print $2+$4+idl+$6}' /proc/stat)"
  22.   ncpu="$(awk 'BEGIN{RS=":"}END{print NR-1}' <<<"${new[*]}")"
  23.   idle="$((${newidle}-${oldidle}))"
  24.  
  25.   awk -v _old="${old}" -v _new="${new}" -v idle="${idle}" '
  26.     {ncpu=$1;split(_old, old, ":");split(_new, new, ":")}
  27.     {for(i=1;i<=ncpu;i++) {work=new[i]-old[i]; printf("%.6f\n", (work-idle)*200/work) }}' <<<"${ncpu}" | grep -E "^(100|[89][0-9])"
  28. }
  29. # FKIN LOAD U WOT
  30. ####awk '$1~/cpu[0-9]/{usage=($2+$4)*100/($2+$4+$5); print $1": "usage"%"}' /proc/stat
  31.  
  32. alias summon=':;'
  33. #function ~~*!!TROOOGDOOOORR^^-=-==-}}%%%% () {
  34. aAaAaAA[  aAaA ~~*!!  TROOOGDOOOORR^^^   -=-==-}}%%%]%(){
  35. # BURNANATING THE PEASANTS
  36.  
  37.   while :; do
  38.   #for x in {0..50}; do
  39.  
  40.   temps=( $(cat /sys/class/thermal/thermal_zone*/temp) )
  41.  
  42.   awk -v DEBUG="$DEBUG" -v _temps="${temps[*]}" -v loud="$yes" '
  43.       function bell(){
  44.           beep="\\x82\\x73\\x70\\x70\\x100\\x31\\x0\\x0\\x87\\x65\\x86\\x69\\x102\\x109\\x116\\x32\\x16\\x0\\x0\\x0\\x1\\x0\\x1\\x0\\x64\\x31\\x0\\x0\\x64\\x31\\x0\\x0\\x1\\x0\\x8\\x0\\x100\\x97\\x116\\x97\\x64\\x31\\x0\\x0"
  45.           wf="\\x79\\x45\\x32\\x45\\x79\\x113\\x126\\x113"
  46.           {for (i=0;i<=800;i++) beep = beep wf}
  47.           {system("aplay -q -r 46000 <<<" beep)}
  48.       }
  49.       function warn(nam, pid, cpu, wlvl){
  50.           {if(wlvl=="ERROR") bell()}
  51.           {system("notify-send \"WARNING:"nam"[pid="pid"] is on fire! \"")}
  52.       }
  53.       function killproc(pid){
  54.           system("/bin/kill -9 " pid)
  55.           #system("/bin/kill -18 " pid)
  56.       }
  57.  
  58.  
  59.       #{if(loud!="no") bell(); system("sleep 3s"); bell(); system("sleep 3s"); bell()}
  60.       {while((getline $0)>0)
  61.           {if(DEBUG) print "[DEBUG]:1="$1"> " $0}
  62.           {if($1 > "85")
  63.             {{"ps hxk-%cpu oetime,pid,%cpu,cmd" |& getline proc; split(proc, pfire)}
  64.               {if(pfire[1] !~ /^\([0-9+-|\)[0-9]+:[0-9]+:[0-9]+/) warn(pfire[4], pfire[2], pfire[3], "ERROR"); killproc(pfire[2])}}
  65.           else
  66.               {next}
  67.           }
  68.           {split(_temps, temps, " ")}
  69.           {for (t in temps)
  70.               {if(t>85000)
  71.                   {{"ps hxk-%cpu oetime,pid,%cpu,cmd" |& getline therm; split(therm, tfire)}
  72.                   {warn(tfire[4], tfire[2], tfire[3], "ERROR"); killproc(tfire[2])}}
  73.               }
  74.           }
  75.       }
  76.  
  77.       ' <(cpuload)
  78.       #ps hxk-%cpu oetime,%cpu,cmd
  79.  
  80.   done
  81.  
  82. }
  83.  
  84. THUNDARR(){
  85.   s="$1" p="${1/0/1}"; P="${1//[01]/2}"
  86.   (/usr/bin/speaker-test -D default -t sine -f "$s" -p"${p:0:1}" -P"${P:1:2}" 2>/dev/null >/dev/null &)
  87.   sleep "$2"s && \
  88.     kill "$(ps ux|awk '/\/usr\/bin\/speaker-test -D default -t sine -f .* -p.* -P.*/ {print $2}')" 2>/dev/null
  89. }
  90.  
  91. ArIsEEEAnDDECImATeohyEDEstOryEROfEVILANdbrInGERofHopE(){
  92.   LITENING="$(base64 -d <<<"ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICggKSB9CiAgICAgICAgICAgICAgICAgICItLV9fX18gICAgICAgICAgICApKQogICAgICAgICAgICIgICAgICApIC1fKCAgICAgICAgXC8gICAoCiAgICAgIF9fXy3CtCBcICAgICB8IF8oICAgICAgICAwICBvCiAgICAgICAgKV8tICBgXyAgIC8gKF9fLStgJyctLS0tLS0tPS4gICAgICAgICBfX19fXwogICAgICAgICAgKV8tICBcLC8tJyAgICAgICAsLS1fX19fX186ICAgICAuLS3CtCAgIC8gICAgICBfX18KICAgIF9fLi0tLS0tXylfLVwgICAgICAgIDwoICAgIFYgdiB2ICAtLS0nICAgICBfJz0tLS0tLScvCiAgLsK0ICAgIC0tICAgLyAgICAgICAgICAgICBgLS0tLS1fX18uIC1fXyAgICAge19fIGAtLS0tJ18KICB8ICAgLCAgICAuwrQgICAgICAgICAgX19fLS0tLS0tLS0tLScgICAgYC1fICAgICAnLS0tLS1fX18tLS0tJwogKCAgICAvJy0tJ3wgICAgICAgICAtLSAgICAgICAgICAgICAgICAgICAgIGAtLS5fXy0tLScnCiAoICAgIC8gICAnICAgICAgICAgLwogIHwgIC9fICAgfCAgICAgICAgfAogICggIF8tKSAgXCAgICAgICAgXAogICAnLV8pICAgICcuICAgICAgIFxfCiAgICAgICAgICAgICAgLV8gICAgICAgXF8KICAgICAgICAgICAgICAgIGAtLV8gICAgIGAtX18KICAgICAgICAgICAgICAgICAgICBgLV9fICAgICBgLV8KICAgICAgICAgICAgICAgIC9cICAgICAgYC1fICAgICBcCiAgICAgICAgLS0uX19BLS9fX1wgICAgICAgXykgICAgIHwgICAgICAgICAgQiAgVSAgUiAgTiAgSSAgTiAgQSAgVCAgRSAgSSAgTiAgRwogICAgICAgICAgICAgYC0tICAgYC0vXF8tJyAgICAgXy8gICAgICAgICAgICAgICAgICBHICBPICBFICBTICAgIE4gIE8gIFcgICEhIQogICAgICAgICAgICAgICAgYC1fXyAgICAgIF9fXy0nCiAgICAgICAgICAgICAgICAgIHwgYC0uLS0nCiAgICAgICAgICAgICAgICAgIHwgICAgXAogICAgICAgICAgICAgICAgICBMX18gICBcXy4tCgo=")"
  93.   SmalLAndTasTYVIlliagEE="$(tty)"
  94.   [[ "$SmalLAndTasTYVIlliagEE" =~ "pts" ]] && printf "%s" "$LITENING"
  95.   NoisEHolESFORWIDydlylWIdlDLYBWAahhaaMP="$(amixer -D default sget Master|awk 'END{print $3}')"
  96.   amixer -q -D default sset Master 45% 2>/dev/null
  97.  
  98.   BIGiTudeENouSnEsS=( '0.33'   '0.07' '0.26'   '0.07' '0.26'   '0.33' '1.66'   '0.33' '0.33' )
  99.   scREaMosSSity=( '0000'   '1180' '1320'   '1180' '0000'   '1580' '820'    '1140'  '1140')
  100.   thaTThINggwhEREyoUkEEpthEThiNG=0
  101.   for HOwmaNyTHinGSwEReInTHissaNYwAy in ${BIGiTudeENouSnEsS[@]}; do
  102.     THUNDARR "${scREaMosSSity[$thaTThINggwhEREyoUkEEpthEThiNG]}" "${HOwmaNyTHinGSwEReInTHissaNYwAy}"; thaTThINggwhEREyoUkEEpthEThiNG=$[thaTThINggwhEREyoUkEEpthEThiNG+1]
  103.     sleep 0.02s
  104.   done
  105.   amixer -q -D default sset Master "${NoisEHolESFORWIDydlylWIdlDLYBWAahhaaMP}" 2>/dev/null
  106. }
  107.  
  108.  
  109. if [[ "${LOoUUD}" == "yes" ]]; then
  110.   ArIsEEEAnDDECImATeohyEDEstOryEROfEVILANdbrInGERofHopE
  111. fi
  112.  
  113. #summon ~~*!!TROOOGDOOOORR^^-=-==-}}%%%%
  114. summon aAaAaAA[  aAaA ~~*!!  TROOOGDOOOORR^^^   -=-==-}}%%%]%
captcha