Skip to content

Instantly share code, notes, and snippets.

View lugrus2000's full-sized avatar

Vladimir lugrus2000

View GitHub Profile
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
<?php
/**
* Skeletal sample shortcode
*/
add_shortcode( 'pilau-sample', 'pilau_sample_shortcode' );
function pilau_sample_shortcode( $atts ) {
extract( shortcode_atts( array(
'text' => ''
), $atts ) );
@lugrus2000
lugrus2000 / !readme.md
Created February 16, 2019 23:16
ST3 sync settings

Синхронизация настроек Sublime Text 3

@lugrus2000
lugrus2000 / Gists for SublimeText3
Created February 17, 2019 22:20
Gists for SublimeText3
Gists for SublimeText3
**********************
Настройка GitHub Gist в sublime text 3
------------------------------------
Первым делом нам нужно сгенерировать token.
------------------------------------------
Переходим на свой гитхаб, идем в settings и там в пункте Applications жмем Generate new token
Далее называем его как угодно и выбираем только один пункт gist и жмем генерировать.
Теперь устанавливаем полученный token в preferences => Package Settings => Gits => Settings-Default
@lugrus2000
lugrus2000 / Развертывание на vps Django с Postgres, Nginx, и Gunicorn
Created February 18, 2019 08:00
Развертывание на vps Django с Postgres, Nginx, и Gunicorn
Развертывание на vps Django с Postgres, Nginx, и Gunicorn на Ubuntu 18.04
*************************************************************************
1.Создаем пользователя с предоставлением рут прав:
--------------------------------------------------
adduser awsnrusl
usermod -aG sudo awsnrusl
проверяем:
groups awsnrusl
@lugrus2000
lugrus2000 / mysite.conf
Created February 19, 2019 15:24
Minimal Nginx config file to WordPress
server {
listen XX.XX.XX.XX:80;
server_name mysite.ru;
root /var/www/mysite.ru;
index index.php index.html index.htm;
error_log /var/log/nginx/mysite.ru_error.log;
access_log /var/log/nginx/mysite.ru_access.log main;
set $fastcgipass unix:/var/lib/php5-fpm/mysite.sock;
@lugrus2000
lugrus2000 / nginx.conf
Created February 19, 2019 15:25
Nginx best config (base config)
user www-data;
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 10000;
worker_shutdown_timeout 30;
pid /run/nginx.pid;
events {
worker_connections 1024;
# Для Linux 2.6+ - epool, Для FreeBSD - kqueue
@lugrus2000
lugrus2000 / mysite.js
Created February 19, 2019 15:26
Image resize with nginx (this is replace phpThumb script)
// Image resize with nginx (this is replace phpThumb script)
function escapeRegExp(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function replaceAll(str, find, replace) {
return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
# Image resize with nginx (this is replace phpThumb script)
js_include mysite.js;
js_set $js_get_uri_src_dirname js_get_uri_src_dirname;
js_set $js_get_image_uri js_get_image_uri;
js_set $js_get_image_filename js_get_image_filename;
js_set $js_get_resized_image_filename js_get_resized_image_filename;
server {
set $dm mysite.ru;
set $cs utf-8;