All posts by amri

ssh грешка: diffie-hellman-group1-sha1

ssh  root@IP -p 22 -v

Unable to negotiate with IP port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@IP -p 22 -v

Тук вече се конектва правилно!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Инсталиране,конфигуриране и пренасочване на ssl сертификат от суперхостинг

1. Генериране на nginx файлове от Суперхостинг

cat "Частен ключ (Private Key)" > nginx.key

cat "Сертификат" > bundle.crt
cat "CA-Bundle / Root certificate" >> bundle.crt

На практика bundle.crt, включва "Сертификат" и "CA-Bundle / Root certificate"
2. .htaccess
RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [L,R=301]

3. Nginx

server
{
listen 80;
listen 443 ssl;
server_name domain.com www.domain.com;
ssl_certificate /etc/nginx/ssl/domain.com/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/domain.comg/nginx.key;
if ($server_port = 80) {
rewrite ^/(.*)$ https://profi.bg/$1 permanent;
}

………..
}

4. Reload
nginx -t
/etc/init.d/nginx reload

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

Chrome Rulz

Xmarks
LastPass
Fiddler
Web developer

Rulz 🙂

/usr/bin/google-chrome-stable -disk-cache-dir="/tmp/ccache/" -disk-cache-size=600000000 --password-store=basic

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Оптимизиране на chrome,firefox -- linux

file:/etc/rc.local

#Optimize chrome
mkdir /tmp/ccache
mount -t tmpfs -o size=512M,mode=0744 tmpfs /tmp/ccache/;
chmod -R 777 /tmp/ccache/;

#Shortcut
#/usr/bin/google-chrome-stable -disk-cache-dir="/tmp/ccache/" -disk-cache-size=600000000 --password-store=basic#Optimize firefox

about:config
browser.cache.disk.enable -- false
browser.cache.memory.enable -- true
about:cache

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Синхронизиране с ftp (lftp) rsync

lftp -u FTP_USER,FTP_PASS -e 'mirror REMOTE_DIRECTORY LOCAL_DIRECTORY' FTP_SERVER

Ако излезе тази грешка:
mirror: Fatal error: Certificate verification: certificate common name doesn't match requested host name ‘FTP_SERVER’
1 error detected

Фикса е:

echo "set ssl:verify-certificate no" >> ~/.lftp/rc

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Sublime

Тук ще описвам интересни бележки за Sublime

Любими плъгини:
Emmet
BracketHighlighter
Color Highlighter
ColorPicker (Ctrl + Shift + C )
Theme Centurion
AutoFileName
TabsExtra
SublimeLinter
sublimelinter
sublimelinter-php
sublimelinter-jshint
HTML-CSS-JS Prettify
SideBarEnhancements
Super Calculator

 

Инсталиране на jshint linux:
apt-get update && apt-get install nodejs npm nodejs-legacy php;
npm install -g jshint;
npm install -g csshint;

Монтиране на ssh на отдалечена машина
apt-get install && apt-get install -y sshfs;
sshfs amri@server.bg:/w/ ~/Desktop/server.bg -o port=33

Синтаксис по подразбиране PHP(може и Html и други):

File: ~/.config/sublime-text-3/Packages/User/default_syntax.py

import sublime, sublime_plugin

class DefaultSyntaxCommand(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/PHP/PHP.tmLanguage')

 

Инсталиране на пакети (в случая emmet за отворени/затворени тагове)

В този случай : emmet
https://packagecontrol.io/installation

ctrl+` или View > Show Consol

import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Ctrl + Shift + P или  Preferences > Package Control > Package Control: Install Package
Emmet и това е 🙂
Комбинацията е Control + Shift + ' и се маркира затварящия таг

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

Инсталиране на yuicompressor (оптимизиране на js, css)

1. Инсталиране на java
mkdir -p /usr/share/java

wget https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar -P /usr/share/java

vi /usr/bin/yc

#!/bin/sh

java -jar /usr/share/java/yuicompressor-2.4.8.jar "$@"
chmod +x /usr/bin/yc
yc default.css -o default-min.css

yc sample.js -o sample-min.js

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)