< Directory /home/app/public_html>
AllowOverride all
Require all granted
< /Directory>
Monthly Archives: November 2015
ubuntu install suphp
a2dismod php5
apt-get install libapache2-mod-suphp
a2enmod suphp
install laravel framework
cd /var/www/html
php /path/to/composer.phar create-project laravel/laravel --prefer-dist
SELinux is preventing /bin/bash from getattr access on the chr_file /dev/pts/6. For complete SELinux messages. run sealert
setroubleshoot[2501]: SELinux is preventing /bin/bash from getattr access on the chr_file /dev/pts/6. For complete SELinux messages. run sealert -l 865f628b-7bed-4036-8df5-c4bf9ab57565
Lap 27 19:43:28 localhost.localdomain python[2501]: SELinux is preventing /bin/bash from getattr access on the chr_file /dev/pts/6.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that bash should be allowed getattr access on the 6 chr_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep bash /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp
Fix:
sudo systemctl stop docker.service
sudo dnf reinstall docker-selinux
sudo systemctl start docker.service
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Downloading…
Fix:
apt-get install curl
php -r "readfile('http://getcomposer.org/installer');" | php
blocksync
#!/usr/bin/env python
"""
Synchronise block devices over the network
Copyright 2006-2008 Justin Azoff
Copyright 2011 Robert Coup
License: GPL
Getting started:
* Copy blocksync.py to the home directory on the remote host
* Make sure your remote user can either sudo or is root itself.
* Make sure your local user can ssh to the remote host
* Invoke:
sudo python blocksync.py /dev/source user@remotehost /dev/dest
"""
import sys
from sha import sha
import subprocess
import time
SAME = "same\n"
DIFF = "diff\n"
def do_open(f, mode):
f = open(f, mode)
f.seek(0, 2)
size = f.tell()
f.seek(0)
return f, size
def getblocks(f, blocksize):
while 1:
block = f.read(blocksize)
if not block:
break
yield block
def server(dev, blocksize):
print dev, blocksize
f, size = do_open(dev, 'r+')
print size
sys.stdout.flush()
for block in getblocks(f, blocksize):
print sha(block).hexdigest()
sys.stdout.flush()
res = sys.stdin.readline()
if res != SAME:
newblock = sys.stdin.read(blocksize)
f.seek(-len(newblock), 1)
f.write(newblock)
def sync(srcdev, dsthost, dstdev=None, blocksize=1024 * 1024):
if not dstdev:
dstdev = srcdev
print "Block size is %0.1f MB" % (float(blocksize) / (1024 * 1024))
# cmd = ['ssh', '-c', 'blowfish', dsthost, 'sudo', 'python', 'blocksync.py', 'server', dstdev, '-b', str(blocksize)]
cmd = ['ssh', '-c', 'blowfish', dsthost, 'python', 'blocksync.py', 'server', dstdev, '-b', str(blocksize)]
print "Running: %s" % " ".join(cmd)
p = subprocess.Popen(cmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True)
p_in, p_out = p.stdin, p.stdout
line = p_out.readline()
p.poll()
if p.returncode is not None:
print "Error connecting to or invoking blocksync on the remote host!"
sys.exit(1)
a, b = line.split()
if a != dstdev:
print "Dest device (%s) doesn't match with the remote host (%s)!" % (dstdev, a)
sys.exit(1)
if int(b) != blocksize:
print "Source block size (%d) doesn't match with the remote host (%d)!" % (blocksize, int(b))
sys.exit(1)
try:
f, size = do_open(srcdev, 'r')
except Exception, e:
print "Error accessing source device! %s" % e
sys.exit(1)
line = p_out.readline()
p.poll()
if p.returncode is not None:
print "Error accessing device on remote host!"
sys.exit(1)
remote_size = int(line)
if size != remote_size:
print "Source device size (%d) doesn't match remote device size (%d)!" % (size, remote_size)
sys.exit(1)
same_blocks = diff_blocks = 0
print "Starting sync..."
t0 = time.time()
t_last = t0
size_blocks = size / blocksize
for i, l_block in enumerate(getblocks(f, blocksize)):
l_sum = sha(l_block).hexdigest()
r_sum = p_out.readline().strip()
if l_sum == r_sum:
p_in.write(SAME)
p_in.flush()
same_blocks += 1
else:
p_in.write(DIFF)
p_in.flush()
p_in.write(l_block)
p_in.flush()
diff_blocks += 1
t1 = time.time()
if t1 - t_last > 1 or (same_blocks + diff_blocks) >= size_blocks:
rate = (i + 1.0) * blocksize / (1024.0 * 1024.0) / (t1 - t0)
print "\rsame: %d, diff: %d, %d/%d, %5.1f MB/s" % (same_blocks, diff_blocks, same_blocks + diff_blocks, size_blocks, rate),
t_last = t1
print "\n\nCompleted in %d seconds" % (time.time() - t0)
return same_blocks, diff_blocks
if __name__ == "__main__":
from optparse import OptionParser
parser = OptionParser(usage="%prog [options] /dev/source user@remotehost [/dev/dest]")
parser.add_option("-b", "--blocksize", dest="blocksize", action="store", type="int", help="block size (bytes)", default=1024 * 1024)
(options, args) = parser.parse_args()
if len(args) < 2:
parser.print_help()
print __doc__
sys.exit(1)
if args[0] == 'server':
dstdev = args[1]
server(dstdev, options.blocksize)
else:
srcdev = args[0]
dsthost = args[1]
if len(args) > 2:
dstdev = args[2]
else:
dstdev = None
sync(srcdev, dsthost, dstdev, options.blocksize)
cat with syntax
yum install python-pip
pip install --upgrade pip
pip install pygmentize
alias c='pygmentize -g'
c /pat/to/some/code_file
mysqldump table without data
mysqldump --no-data -h localhost mydb > /root/mydb.sql
iptables block outgoing smtp
iptables -I OUTPUT 1 -p tcp --dport 25 -j DROP
iptables -I OUTPUT 1 -p tcp --dport 587 -j DROP
postfix check queue mail number
postqueue -p | tail -n 1 | cut -d' ' -f5
phpunit/phpunit 4.8.9 requires ext-dom
yum -y install php55w-xml
install remi repo
For Centos 6:
yum install http://remi.schlundtech.de/enterprise/remi-release-6.rpm
centos install bower
yum install npm
npm install -g bower
tcpdump grep packet content
tcpdump -nnvvXSs 1514 'dst port 80' | grep -i some_host
Berkeley DB error: /var/spool/exim/db/retry: unexpected file type or format
cp -Ra /var/spool/exim/db{,orig}
service exim stop && rm -rf /var/spool/exim/db/* && service exim start