posted in Linux 

curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar
chmod +x cachetool.phar

Αφού γίνει install αρχίζουν τα καλά.

Κάνουμε ένα ls /var/run βρίσκουμε το socket της php-fpm και φτιάχνουμε
το command μας .

/usr/bin/php /root/cachetool/cachetool.phar opcache:reset --fcgi=/var/run/phpfpm.sock

Έχει και άλλα commands

**apc**
  apc:bin:dump             Get a binary dump of files and user variables
  apc:bin:load             Load a binary dump into the APC file and user variables
  apc:cache:clear          Clears APC cache (user, system or all)
  apc:cache:info           Shows APC user & system cache information
  apc:cache:info:file      Shows APC file cache information
  apc:key:delete           Deletes an APC key
  apc:key:exists           Checks if an APC key exists
  apc:key:fetch            Shows the content of an APC key
  apc:key:store            Store an APC key with given value
  apc:sma:info             Show APC shared memory allocation information
**apcu**
  apcu:cache:clear         Clears APCu cache
  apcu:cache:info          Shows APCu user & system cache information
  apcu:cache:info:keys     Shows APCu keys cache information
  apcu:key:delete          Deletes an APCu key
  apcu:key:exists          Checks if an APCu key exists
  apcu:key:fetch           Shows the content of an APCu key
  apcu:key:store           Store an APCu key with given value
  apcu:regexp:delete       Deletes all APCu key matching a regexp
  apcu:sma:info            Show APCu shared memory allocation information
**opcache**
  opcache:configuration    Get configuration information about the cache
  opcache:reset            Resets the contents of the opcode cache
  opcache:status           Show summary information about the opcode cache
  opcache:status:scripts   Show scripts in the opcode cache
**stat**
  stat:clear               Clears the file status cache, including the realpath cache
  stat:realpath_get        Show summary information of realpath cache entries
  stat:realpath_size       Display size of realpath cache

Πηγή

posted in Linux 

Ας κάνουμε την ζωή μας πιο εύκολη.

extract () {
   if [ -f $1 ] ; then
       case $1 in
           *.tar.bz2)   tar xvjf $1    ;;
           *.tar.gz)    tar xvzf $1    ;;
           *.bz2)       bunzip2 $1     ;;
           *.rar)       unrar x $1       ;;
           *.gz)        gunzip $1      ;;
           *.tar)       tar xvf $1     ;;
           *.tbz2)      tar xvjf $1    ;;
           *.tgz)       tar xvzf $1    ;;
           *.zip)       unzip $1       ;;
           *.Z)         uncompress $1  ;;
           *.7z)        7z x $1        ;;
           *)           echo "don't know how to extract '$1'..." ;;
       esac
   else
       echo "'$1' is not a valid file!"
   fi
 }
alias checkip='dig +short myip.opendns.com @resolver1.opendns.com.'
export HISTFILESIZE=20000
export HISTSIZE=10000
shopt -s histappend
# Combine multiline commands into one in history
shopt -s cmdhist
# Ignore duplicates, ls without options and builtin commands
HISTCONTROL=ignoredups

MacOS only command:

alias cleardns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder;say DNS clear'

posted in Applescript 

Αν έχεις πολλούς servers να κάνεις connect και δεν μπορείς να θυμάσαι όλα αυτά τα password και φυσικά το
ενδεχόμενο των ssh keys δεν υπάρχει. Τότε η λύση είναι Applescript.

tell application "Terminal"
    activate
    do script "ssh user@hostname.tld”
    delay 1
    tell application "System Events"
        keystroke “password”
        keystroke return
    end tell
end tell

Save as application και έτοιμο το shortcut!

posted in Linux 

Αυτό είναι το δικό μου configuration file. Χρησιμοποίησα το Percona Configuration Wizard.


# CLIENT #
port                           = 3306
socket                         = /var/run/mysqld/mysqld.sock

[mysqld]

# GENERAL #
user                           = mysql
default-storage-engine         = MyISAM
socket                         = /var/run/mysqld/mysqld.sock
pid-file                       = /var/run/mysqld/mysqld.pid

# MyISAM #
key-buffer-size                = 256M
myisam-recover                 = FORCE,BACKUP

# SAFETY #
max-allowed-packet             = 16M
max-connect-errors             = 1000000
sql-mode                       = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY
sysdate-is-now                 = 1
innodb                         = FORCE
innodb-strict-mode             = 1

# DATA STORAGE #
datadir                        = /var/lib/mysql/

# BINARY LOGGING #
log-bin                        = /var/lib/mysql/mysql-bin
expire-logs-days               = 14
sync-binlog                    = 1

# CACHES AND LIMITS #
tmp-table-size                 = 32M
max-heap-table-size            = 32M
query-cache-type               = 0
query-cache-size               = 0
max-connections                = 500
thread-cache-size              = 50
open-files-limit               = 65535
table-definition-cache         = 1024
table-open-cache               = 2048

# INNODB #
innodb-flush-method            = O_DIRECT
innodb-log-files-in-group      = 2
innodb-log-file-size           = 32M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table          = 1
innodb-buffer-pool-size        = 8M

# LOGGING #
log-error                      = /var/lib/mysql/mysql-error.log
log-queries-not-using-indexes  = 1
slow-query-log                 = 1
slow-query-log-file            = /var/lib/mysql/mysql-slow.log
posted in Linux 

<IfModule mpm_prefork_module> 
StartServers 1 
MinSpareServers 1 
MaxSpareServers 3 
MaxClients 10 
MaxRequestsPerChild 3000
</IfModule>

<IfModule mpm_worker_module> 
StartServers 1 
MinSpareThreads 5 
MaxSpareThreads 15 
ThreadLimit 25 
ThreadsPerChild 5 
MaxClients 25 
MaxRequestsPerChild 200
</IfModule>

Δεν πρέπει να έχουμε και πολλά στο Log μόνο τα errors. Βοηθάει πολύ όταν δεν υπάρχει πολύ μνήμη.

# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost> # container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log
#
# LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg.
#
LogLevel error
posted in Linux 

sudo apt-get install ssmtp
sudo apt-get install mailutils
 
Now edit the SSMTP configuration file
 
sudo nano /etc/ssmtp/ssmtp.conf
 

mailhub=smtp.gmail.com:587
hostname=raspberrypi
AuthUser=username@gmail.com
AuthPass=TheGmailPassword
FromLineOverride=YES
UseSTARTTLS=YES
posted in Linux 

The problem:

hickfhkhhdnamfnh

The fix:

  • Πόσους kernel έχω; rpm -q kernel
  • Πόσους να σβήσω; (count) package-cleanup --oldkernels --count=2

Κρατάμε πάντα τουλάχιστον 2 kernel.

After:

ioodcjgoheccbhmf