Skip to content

Instantly share code, notes, and snippets.

View sergeylukin's full-sized avatar
🎯
Focusing

Sergey Lukin sergeylukin

🎯
Focusing
View GitHub Profile
@sergeylukin
sergeylukin / awk_vs_grep.sh
Last active December 17, 2015 06:19
Profiling AWK vs GREP in sorting file contents in custom order (AWK is 2 times faster)
#! /usr/bin/env sh
###
### awk_vs_grep.sh - Profiles 2 methods used to sort file contents using custom pattern
### make sure to have file "awk_vs_grep.txt" with some content
### for more details refer to this Question: http://unix.stackexchange.com/questions/75498/sort-using-custom-pattern/
###
### Usage: `./awk_vs_grep.sh` - will execute commands 10 times and only print profile results
### Usage: `./awk_vs_grep.sh 1000` - will execute commands 1000 times and only print profile results
### Usage: `./awk_vs_grep.sh 1000 /dev/tty` - will execute commands 1000 times and print commands output + results
// This patch changes the way Candle's UP state is detected
// Instead of comparing it to the previous candle, we just compare CLOSE and OPEN
// values here
(function(HC) {
var seriesTypes = HC.seriesTypes;
seriesTypes.candlestick.prototype.getAttribs = function () {
seriesTypes.column.prototype.getAttribs.apply(this, arguments);
@sergeylukin
sergeylukin / branch2command.sh
Created June 23, 2013 19:02
Run commands remotely through `git push` - example with 1 level deployment
#! /usr/bin/env sh
# This script accepts 1 mandatory argument:
# COMMAND
#
# It's run by git repo hook and current
# workign directory is the bare repo path
#
# Global variables accessible:
# $WORKTREE (points to the working tree)
#
@sergeylukin
sergeylukin / branch2command.sh
Created June 23, 2013 19:08
Run commands remotely through `git push` - example with 2 levels deployment
#! /usr/bin/env sh
# This script accepts 2 mandatory arguments:
# COMMAND and ENVIRONMENT
#
# It's run by git repo hook and current
# workign directory is the bare repo path
#
# Global variables accessible:
# $WORKTREE (points to the working tree)
#
@sergeylukin
sergeylukin / optimg.sh
Last active July 3, 2019 07:15
Shell script for JPGs and PNGs optimization
#!/usr/bin/env sh
#
# This script automates images optimization
# is mainly used by a developer who manually
# can execute it when adding new images to the
# project
#
# Download and compile following binaries:
#
# - [jpegtran](http://www.ijg.org/)
@sergeylukin
sergeylukin / make.conf
Created November 19, 2013 15:08
Optimized system-wide makefile for FreeBSD. Saved in /etc/make.conf
# default to -j6 for make
FORCE_MAKE_JOBS=yes
MAKE_JOBS_NUMBER=6
# specific options/etc for ports
.if ${.CURDIR:M*/databases/mysql*-server}
BUILD_OPTIMIZED=yes
.endif
# static zsh build for root
@sergeylukin
sergeylukin / post-receive
Last active August 29, 2015 13:55
git hook that sets flags according to modified files
while read oldrev newrev refname
do
COMPILE_JAVASCRIPTS=0
COMPILE_IMAGES=0
COMPILE_STYLESHEETS=0
for file in `git diff $oldrev $newrev --name-only`; do
if [ `echo $file | cut -c 1-22` == "app/assets/javascripts" \
-o \
`echo $file | cut -c 1-25` == "shared/assets/javascripts" \
@sergeylukin
sergeylukin / .vimrc
Created July 3, 2014 23:05
Minimal vim configuration for root user
" This is my minimal Vim configuration file I usually save as `/root/.vimrc`
" for the occasions when I'm logged in as root user and I need to edit files
" (this doesn't usually happen, but when it happens, I have vim configuration
" that makes sense).
"
" It doesn't require any plugins and aims to work with minimal Vim installation
"
" Forget compatibility with VI
set nocompatible
@sergeylukin
sergeylukin / readme.md
Last active August 29, 2015 14:07
Programs browser for DOS 6.22

Browser

browser.exe displays programs found in current directory's subdirectories in an easy to look through interface. Programs meta information (name, description, screenshots references) is stored in browser.yaml file found in programs' directory.

Here is UI prototype:

@sergeylukin
sergeylukin / HttpLink.mq4
Last active October 19, 2021 13:27
Opening a Webpage in the default browser from within MetaTrader