Skip to content

Instantly share code, notes, and snippets.

View pironim's full-sized avatar

Volodymyr Zhukov pironim

View GitHub Profile
@pironim
pironim / gist:2f578c60afb67f156136
Created September 16, 2014 08:38
git pre-commit hook to check branch name
#!/bin/bash
#
# Pre-commit hooks
# Check branch name
BRANCH_NAME_LENGTH=`git rev-parse --abbrev-ref HEAD | grep -E '^t[0-9]{2,16}\_.*_[A-Za-z]{2,2}$' | wc -c`
if [ ${BRANCH_NAME_LENGTH} -eq 0 ] ; then
echo -e '\E[37;44m'"\033[1mERROR\033[0m in pre-commit hook: vim /export/web/.git/hooks/pre-commit"
echo "Branch name should be like t00000_blah_blah_CA - brand is two letters"
@pironim
pironim / UnlimitedJCEPolicyJDK8.sh
Last active September 27, 2017 03:55
apply UnlimitedJCEPolicyJDK8
JCE_DIR="$(dirname $(dirname $(readlink -f $(which javac))))/jre/lib/security"
echo JCE_DIR
# http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
# http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
# Dowload and unpack UnlimitedJCE policy files
@pironim
pironim / variance.md
Created July 7, 2016 14:15 — forked from maiermic/variance.md
Description of the four kinds of variance: covariance, contravariance, invariance and bivariance.

Variance

The term variance describes how subtyping between higher kinded types is related to subtyping relations of their type arguments.

Higher Kinded Types

A higher kinded type composes type arguments to a new type. I use square bracket notation to define a higher kinded type:

C[T] // The higher kinded type `C` composes type argument `T` to a new type `C[T]`.

The same works with multiple type arguments:

@pironim
pironim / gist:6239572
Last active December 21, 2015 03:08
git aliases
git config --global alias.br branch
git config --global alias.cp cherry-pick
git config --global alias.cm commit
git config --global alias.co checkout
git config --global alias.s status
@pironim
pironim / page for id
Created July 11, 2013 13:02
Kaminary find page for id
# You should sort by uniq column to make your results predictable
def pagination_base
current_company.projects.order('name ASC, id ASC')
end
def page_for(id)
ids = pagination_base.pluck(:id)
position = ids.index(id.to_i)
@pironim
pironim / gist:5687716
Last active December 17, 2015 23:09
Install zsh
cd ~/Downloads
wget http://sourceforge.net/projects/zsh/files/zsh/5.0.2/zsh-5.0.2.tar.bz2/download -O zsh-5.0.2.tar.bz2
tar zvjf zsh-5.0.2.tar.bz2
cd zsh-5.0.2
./Util/preconfig
./configurea
make
make check
sudo make inststall
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@pironim
pironim / es.sh
Created March 1, 2013 11:54 — forked from sgringwe/es.sh
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
# Download the compiled elasticsearch rather than the source.
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@pironim
pironim / gist:3756518
Created September 20, 2012 15:13
MySQL Workbench on LinuxMint 12
MySQL Workbench on LinuxMint 12
Posted At : April 3, 2012 4:47 PM | Posted By : ColdFusion Joe
Related Categories: Ubuntu, LinuxMint, MySQL
Can't install MySQL Workbench on LinuxMint 12? Can't find MySQL Workbench in the Software Manager or Synaptic? Here's all you have to do:
view plain print about
1 sudo add-apt-repository ppa:olivier-berten/misc
2 sudo apt-get update
3 sudo apt-get install mysql-workbench-gpl
@pironim
pironim / gist:3722006
Created September 14, 2012 13:46
vim trailing space highlight
Unobtrusive highlighting of trailing whitespace in Vim
Sunday, September 13, 2009
Many programmers highlight trailing whitespace red to expose that unnecessary gunk that is otherwise hard to spot. I did not much care about trailing whitespace, it was never a problem for me, though now the distributed version control systems tend to complain about this.
Highlighting the trailing whitespace is effective but has this unwanted side-effect of a red thing appearing under the cursor when typing space at the end of line (most of the time I type space at the end of line it seems).
This set of commands will only highlight the trailing whitespace on opening the buffer and leaving the insert mode. Inspired by the Vim tip wiki.