Skip to content

Instantly share code, notes, and snippets.

View supaweb's full-sized avatar

Nickolay Stolyarov supaweb

View GitHub Profile
@supaweb
supaweb / addsite.sh
Created May 20, 2019 15:22
Ubuntu 10.04 (nginx + php5-fpm): Install MODX 2.2 including user, virtual host, database
#!/bin/bash
# MySQL root password
ROOTPASS='password'
TIMEZONE='Europe/Moscow'
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
##############
@supaweb
supaweb / RedirectsCept.php
Created May 20, 2019 15:21 — forked from GaryJones/RedirectsCept.php
Codeception 301 Redirection Tests
<?php
$I = new RedirectsTester($scenario);
$I->wantTo('check 301 redirects are working');
// First, test /login/ page gets rewritten to https://
$I->seePermanentRedirectToHttpsFor('login/');
$I->seePermanentRedirectToHttpsFor('login/?redirect_to=foo');
@supaweb
supaweb / gist:1368283829ee4780b1b4304b07b99f4c
Created July 31, 2018 12:52 — forked from urre/gist:3319920e694b821a2ad0e5a361fdbe4d
Laravel Mix with Stylelint and Browsersync
let mix = require('laravel-mix');
let StyleLintPlugin = require('stylelint-webpack-plugin');
mix.webpackConfig({
plugins: [
new StyleLintPlugin({
files: './assets/sass/**/*.scss',
configFile: './.stylelintrc'
}),
]
@supaweb
supaweb / nginx.conf
Created December 8, 2017 20:18 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
<?php
$str = 'fD3_';
$chars = array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9'), ['_']);
$total = 0;
$brut = '';
$len = strlen($str);
/**
* @see: https://www.programmingalgorithms.com/algorithm/brute-force?lang=PHP
*/