Skip to content

Instantly share code, notes, and snippets.

View Brick85's full-sized avatar

Vital Belikov Brick85

View GitHub Profile
@Brick85
Brick85 / ubuntu
Last active December 16, 2015 19:19
Ubuntu hints
Resize terminal:
resize -s 25 80
Test HDD speed:
dd if=/dev/zero of=zeros bs=1M count=500 oflag=direct; unlink zeros
dd if=/dev/zero of=zeros bs=64k count=16k conv=fdatasync; unlink zeros
@Brick85
Brick85 / gist:5009046
Last active May 3, 2019 09:35
OpenCV Alpha Blending: Blend two cv::Mat with alpha mask. Poorly optimised.
void blendWithMask(cv::Mat &base, cv::Mat &src, cv::Mat &mask, cv::Mat &out){
char ch = base.channels();
double alpha = 0;
for( int y = 0; y < base.rows; y++ ){
uchar* pBS = base.ptr<uchar>(y);
uchar* pSR = src.ptr<uchar>(y);
uchar* pMK = mask.ptr<uchar>(y);
uchar* pOU = out.ptr<uchar>(y);
for( int x = 0; x < base.cols*ch; x++ ){
int ix = x / ch;
@Brick85
Brick85 / gist:4538097
Last active December 11, 2015 03:29
Django imports
from django.conf.urls.i18n import i18n_patterns
from django.core.urlresolvers import reverse
@Brick85
Brick85 / settings_initial.py
Last active October 12, 2015 07:48
Django initial
# settings.py
import os
rel = lambda *x: os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), *x)
gettext = lambda s: s
LANGUAGES = (
('ru', gettext('Russian')),
('en', gettext('English')),
('lv', gettext('Latvian')),
)
@Brick85
Brick85 / gist:3960024
Created October 26, 2012 17:14
Exim test mailsend
exim -bh IP
@Brick85
Brick85 / gist:3895340
Created October 15, 2012 20:47
FreeBSD edit php.ini
chflags nosunlnk php.ini; chflags noschg php.ini; replace "safe_mode = Off" "safe_mode = On" -- php.ini; replace "safe_mode_gid = On" "safe_mode_gid = Off" -- php.ini; replace "sql.safe_mode = On" "sql.safe_mode = Off" -- php.ini; chflags sunlnk php.ini; chflags schg php.ini