Skip to content

Instantly share code, notes, and snippets.

View vitalybaev's full-sized avatar

Vitaly Baev vitalybaev

View GitHub Profile
@vitalybaev
vitalybaev / mongos
Created June 15, 2012 13:44 — forked from fabioperrella/mongos
MongoDB init script for Mongos in Debian
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
@vitalybaev
vitalybaev / redis_server_debian_inid_script
Created August 27, 2012 21:57
Redis-server Debian init.d script
#!/bin/sh
### BEGIN INIT INFO
# Short-Description: Redis-server Daemon
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
# Author: Vitaly Baev
#
# Please remove the "Author" lines above and replace them
VERSION=0.20.6
sudo apt-get update
sudo apt-get install openjdk-6-jdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$VERSION.deb
sudo dpkg -i elasticsearch-$VERSION.deb
# be sure you add "action.disable_delete_all_indices" : true to the config!!
requests.put('http://localhost:9200/site/', data=json.dumps({
'settings': {
'analysis': {
'analyzer': {
'ru': {
'type': 'custom',
'tokenizer': 'standard',
"filter": ['lowercase', 'russian_morphology', 'english_morphology', 'ru_stopwords', 'ru_stemming'],
},
},
VERSION=0.20.6
sudo apt-get update
sudo apt-get install openjdk-6-jdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$VERSION.deb
sudo dpkg -i elasticsearch-$VERSION.deb
# be sure you add "action.disable_delete_all_indices" : true to the config!!
@vitalybaev
vitalybaev / ASDisplayNodeDraw
Created October 1, 2015 15:54 — forked from cemolcay/ASDisplayNodeDraw
ASDisplayNode draw shadow & border
override class func drawRect(
bounds: CGRect,
withParameters parameters: NSObjectProtocol!,
isCancelled isCancelledBlock: asdisplaynode_iscancelled_block_t!,
isRasterizing: Bool) {
let context = UIGraphicsGetCurrentContext()
CGContextSaveGState(context)
CGContextSetShadowWithColor(context, CGSize (width: 0, height: 1), 10, UIColor.TitleColor().CGColor)
@vitalybaev
vitalybaev / debian8init.sh
Last active January 16, 2017 06:41
Debian 8 Init
# Устанавливаем русскую локаль
localedef ru_RU.UTF-8 -i ru_RU -fUTF-8
# Добавляем dotdeb.org репозиторий
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
# Устанавливаем необходимые пакеты
apt-get install -y sudo nano build-essential apt-utils ntp sudo htop git zip apt-transport-https
apt-get install -y nginx php7.0 php7.0-curl php7.0-fpm php7.0-imagick php7.0-json php7.0-mbstring php7.0-mongodb php7.0-pdo-mysql php7.0-zip php7.0-dom
@vitalybaev
vitalybaev / what-forces-layout.md
Created June 11, 2020 22:36 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@vitalybaev
vitalybaev / gist:5b3b22a91829a2f8eedf17d98fd68fef
Created June 19, 2020 07:44 — forked from ayamflow/gist:b602ab436ac9f05660d9c15190f4fd7b
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@vitalybaev
vitalybaev / Hello.m
Created December 3, 2020 15:41 — forked from rainzoo/Hello.m
Compile and run Objective C program on Ubuntu 11.04
#import <Foundation/Foundation.h>
int main (int argc, const char *argv[])
{
@autoreleasepool {
NSLog(@"Hello World");
}
}