A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

h-barplot - Stikked
From Florian Baumann, 13 Years ago, written in Bash.
Embed
  1. #!/bin/bash
  2. # statistical: gernerate easy statistical informations in bash
  3. # Copyright: (C) 2011 Florian Baumann <flo@noqqe.de>
  4. # License: GPL-3 <http://www.gnu.org/licenses/gpl-3.0.txt>
  5. # Date: Tuesday 2011-04-12
  6.  
  7. ### Locales
  8. SUM="$*"        # see all key value pairs
  9. OUTPUTCHAR='#'  # configure this to your favorite ascii char
  10. BORDERCHAR='|'  # configure this to your favorite ascii char
  11. BIGKEY=0        # usually you dont have to touch this
  12.  
  13. # Read from stdin hack
  14. if [ -z "$*" ]; then
  15.     SUM=$(cat /dev/stdin)
  16. fi
  17.    
  18. ### Scaling and environment analysis for optimal output on
  19. # the most terminals
  20. for data in $SUM; do
  21.  
  22.     # Getting informations from parameters
  23.     KEY=${data%%:*}
  24.     VALUE=${data##*:}
  25.  
  26.     # Fishing errors from wrong usage
  27.     if [[ ! $VALUE =~ ^[[:digit:]]+$ ]]; then
  28.         echo "ERROR: Do not use characters as value! Key:$KEY Value:$VALUE"
  29.         exit 1
  30.     fi
  31.  
  32.     # Bash couldn't handle values with more than 19 numbers
  33.     # Values longer than 19 will be transformed into strings.
  34.     # String could not be graphed :)
  35.     if [[ ${#VALUE} -gt 19 ]]; then
  36.         echo "Error: Bash couldn't handle values with more than 19 numbers. Sorry."
  37.         exit 1
  38.     fi
  39.  
  40.     # Doing the right formatting for a global
  41.     # tabulator spaces work
  42.     if [ ${#KEY} -gt 23 ]; then
  43.         BIGKEY=3
  44.     elif [ ${#KEY} -gt 15 ]; then
  45.         BIGKEY=2
  46.     elif [ ${#KEY} -gt 7 ]; then
  47.         BIGKEY=1
  48.     fi
  49.  
  50.     # Fishing the biggest value
  51.     (( VALUE > MAXVALUE )) && MAXVALUE=$VALUE
  52.  
  53. done
  54.  
  55. # Creating the right factor to fit the bars up to your terminal
  56. FACTORCOUNT=0
  57. FACTOR=1
  58. while [ ${FACTORCOUNT} -lt $(( ${#MAXVALUE} - 2 )) ]; do
  59.     FACTOR="${FACTOR}0"
  60.     ((FACTORCOUNT++))
  61. done
  62.  
  63. # Start graphing
  64. for data in $SUM; do
  65.  
  66.     KEY=${data%%:*}
  67.     VALUE=${data##*:}
  68.     REAL_VALUE="$VALUE"
  69.     COUNTER="0"
  70.    
  71.     # Do value scaling action for terminal
  72.     VALUE=$(($VALUE / $FACTOR))
  73.    
  74.     # Do key scaling action for terminal
  75.     if [ ${#KEY} -ge 23 ]; then
  76.         KEY=${KEY:0:22}
  77.     fi
  78.  
  79.     # Formatting the keys for your graph
  80.     if [ $BIGKEY -eq 3 -a ${#KEY} -lt 8 ]; then
  81.         echo -n -e "${KEY}\t\t\t\t"
  82.     elif [ $BIGKEY -eq 3 -a ${#KEY} -lt 15 ]; then
  83.         echo -n -e "${KEY}\t\t\t"
  84.     elif [ $BIGKEY -eq 3 -a ${#KEY} -lt 23 ]; then
  85.         echo -n -e "${KEY}\t\t"
  86.     elif [ $BIGKEY -eq 2 -a ${#KEY} -lt 8 ]; then
  87.         echo -n -e "${KEY}\t\t\t"
  88.     elif [ $BIGKEY -eq 2 -a ${#KEY} -lt 15 ]; then
  89.         echo -n -e "${KEY}\t\t"
  90.     elif [ $BIGKEY -eq 1 -a ${#KEY} -lt 8 ]; then
  91.         echo -n -e "${KEY}\t\t"
  92.     else
  93.         echo -n -e "${KEY}\t"
  94.     fi
  95.  
  96.     # Putting the choosen char for border
  97.     echo -n "$BORDERCHAR"
  98.  
  99.     # Putting a output char for each (scaled) value
  100.     # If the last char was written, write the real value
  101.     while [ $COUNTER -le $VALUE ]; do
  102.        
  103.         ((COUNTER++))
  104.        
  105.         if [ $COUNTER -gt $VALUE ]; then
  106.             echo -n " ($REAL_VALUE)" ; echo
  107.         else
  108.             echo -n "$OUTPUTCHAR"
  109.         fi
  110.  
  111.     done
  112. done

Replies to h-barplot rss

Title Name Language When
h-barplot usage Melodic Parakeet bash 13 Years ago.