Skip to content

Instantly share code, notes, and snippets.

View akeinhell's full-sized avatar
:bowtie:

Алексей Дорохов akeinhell

:bowtie:
  • vsemayki.ru
  • Новосибирск
View GitHub Profile
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get install -y language-pack-en-base
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
apt-get install \
php7.0 \
@akeinhell
akeinhell / ldap pass
Created March 17, 2016 10:00
ldap pass
$encoded_newPassword = "{SHA}" . base64_encode( pack( "H*", sha1( $newPassword ) ) );
@akeinhell
akeinhell / gist:49e5f558b38847d3b2d7
Last active September 5, 2023 17:58
регулярка мат фильтр
\w{0,5}[хx]([хx\s\!@#\$%\^&*+-\|\/]{0,6})[уy]([уy\s\!@#\$%\^&*+-\|\/]{0,6})[ёiлeеюийя]\w{0,7}|\w{0,6}[пp]([пp\s\!@#\$%\^&*+-\|\/]{0,6})[iие]([iие\s\!@#\$%\^&*+-\|\/]{0,6})[3зс]([3зс\s\!@#\$%\^&*+-\|\/]{0,6})[дd]\w{0,10}|[сcs][уy]([уy\!@#\$%\^&*+-\|\/]{0,6})[4чkк]\w{1,3}|\w{0,4}[bб]([bб\s\!@#\$%\^&*+-\|\/]{0,6})[lл]([lл\s\!@#\$%\^&*+-\|\/]{0,6})[yя]\w{0,10}|\w{0,8}[её][bб][лске@eыиаa][наи@йвл]\w{0,8}|\w{0,4}[еe]([еe\s\!@#\$%\^&*+-\|\/]{0,6})[бb]([бb\s\!@#\$%\^&*+-\|\/]{0,6})[uу]([uу\s\!@#\$%\^&*+-\|\/]{0,6})[н4ч]\w{0,4}|\w{0,4}[еeё]([еeё\s\!@#\$%\^&*+-\|\/]{0,6})[бb]([бb\s\!@#\$%\^&*+-\|\/]{0,6})[нn]([нn\s\!@#\$%\^&*+-\|\/]{0,6})[уy]\w{0,4}|\w{0,4}[еe]([еe\s\!@#\$%\^&*+-\|\/]{0,6})[бb]([бb\s\!@#\$%\^&*+-\|\/]{0,6})[оoаa@]([оoаa@\s\!@#\$%\^&*+-\|\/]{0,6})[тnнt]\w{0,4}|\w{0,10}[ё]([ё\!@#\$%\^&*+-\|\/]{0,6})[б]\w{0,6}|\w{0,4}[pп]([pп\s\!@#\$%\^&*+-\|\/]{0,6})[иeеi]([иeеi\s\!@#\$%\^&*+-\|\/]{0,6})[дd]([дd\s\!@#\$%\^&*+-\|\/]{0,6})[oоаa@еeиi]([oоаa@еeиi\s\!@#\$%\^&*+-\|\/]{0,6})[рr]\w{0,12}|\w{0,6}[cсs][уu][kк][aа]
Резервное копирование баз данных PostgreSQL.
http://interface31.ru/tech_it/2013/07/rezervnoe-kopirovanie-bez-dannyh-postgresql.html
https://gist.github.com/akeinhell/763617fae52fdacfec48
http://goo.gl/SCScpd
@akeinhell
akeinhell / 1c.bat
Created December 31, 2015 02:13
Созданеие бекапа
set PATH=%PATH%;%ProgramFiles(x86)%\PostgreSQL\9.1.9-1.1C\bin;%ProgramFiles%\7-Zip
echo %PATH%
set DAT=%date:~6,4%%date:~3,2%%date:~0,2%
cd C:\backup
pg_dump -U postgres unf14 > %DAT%-unf14.pgsql.backup
7z a -tzip %DAT%-unf14.pgsql.zip %DAT%-unf14.pgsql.backup
@akeinhell
akeinhell / installphp7.sh
Last active December 9, 2015 07:37 — forked from tronsha/installphp7.sh
Install PHP7 to Ubuntu
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
@akeinhell
akeinhell / test
Created March 30, 2015 04:49
test wg
<?php
require 'src/WotApi/Api.php';
require 'vendor/autoload.php';
use WotApi\Api;
Api::create()->setApplicationId('demo');
Api::onSuccess(
function($response, $args){
print '->'.sizeof(explode(',',$args[0]['clan_id'])).' OK'.PHP_EOL;
@akeinhell
akeinhell / CPP API WoT
Last active August 29, 2015 14:17
CPP API WoT
//---------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "curl/curl.h"
//#pragma comment(lib,"curllib.lib") // для VC++
//--------------------------------------------------------------------------
const size_t BUF_SIZE= 5000000;
char wr_buf[5000001];
size_t wr_index=0;
@akeinhell
akeinhell / ip check mask
Created February 11, 2015 09:54
Проверка IP В диапазоне
function matchCIDR($addr,$cidr) {
list($ip,$mask) = explode('/',$cidr);
return (ip2long($addr) >> (32 - $mask) == ip2long($ip) >> (32 - $mask));
}
function cidr_match($ip, $range)
{
list ($subnet, $bits) = explode('/', $range);
@akeinhell
akeinhell / Select Random row
Created February 11, 2015 08:10
Выбор случайной строки в Mysql
SELECT FLOOR(count(*)*RAND()) INTO @max FROM table;
PREPARE STMT FROM 'SELECT * FROM table LIMIT ?,1';
EXECUTE STMT USING @max;