Skip to content

Instantly share code, notes, and snippets.

@amaslenn
amaslenn / .gitconfig
Last active May 15, 2017 09:24
Git aliases and config for Beyond Compare 3
[user]
name = Maslennikov, Andrey
email = andrew.maslennikov@gmail.com
[alias]
st = status -sb
br = branch
co = checkout
ci = commit
rb = rebase
hist = log --graph --pretty=format:\"%C(red)%h%C(reset) %C(cyan)%ad%C(reset) [%C(green)%an%C(reset)] %C(bold)%d%C(reset) %s\" --abbrev-commit --date=short
@amaslenn
amaslenn / Preferences.sublime-settings
Last active July 12, 2016 06:25
Sublime Text 3 settings
{
"default_line_ending": "unix",
"draw_white_space": "all",
"enable_tab_scrolling": false,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
@amaslenn
amaslenn / .vimrc
Last active February 26, 2017 16:18
Vim config
" Vundle and friends
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'flazz/vim-colorschemes'
call vundle#end()
filetype plugin indent on
" colorscheme

Convert CRLF to LF
find . -name '*.p?' -exec dos2unix {} \;

Get mount point for a directory
df -P /di/rec/to/ry | tail -1 | cut -d' ' -f 1

@amaslenn
amaslenn / gg.md
Last active August 29, 2015 14:07
Git and Gerrit

Git and Gerrit

Short story of two tools

First push

Prerequisites:

git clone <repo>
cd <repo>
git checkout work-branch

work work work

# run external cmd and dump its output in ~realtime
sub run_or_die {
my $cmd = shift;
local $| = 1;
say "[cmd]: $cmd";
open my $hp, "$cmd |" or die "$!\n";
while (<$hp>) {
s/\r|\n//g;
say;
@amaslenn
amaslenn / git-commit-size.pl
Created February 13, 2017 07:30
Get size of commits using perl
# found here: http://stackoverflow.com/questions/1286183/git-find-fat-commit
#!/usr/bin/perl
foreach my $rev (`git rev-list --all --pretty=oneline`) {
my $tot = 0;
($sha = $rev) =~ s/\s.*$//;
foreach my $blob (`git diff-tree -r -c -M -C --no-commit-id $sha`) {
$blob = (split /\s/, $blob)[3];
next if $blob == "0000000000000000000000000000000000000000"; # Deleted
my $size = `echo $blob | git cat-file --batch-check`;
@amaslenn
amaslenn / build-install-git.sh
Last active May 15, 2017 09:23
Build and install git from sources
git checkout <tag>
make configure
./configure --with-curl
make -j4 all doc
sudo make install install-man

I don't care about history

git remote add secret_prefix-tools ssh://amaslenn@server.com:1234/secret_prefix-tools
git fetch secret_prefix-tools
git branch tools secret_prefix-tools/master
git read-tree --prefix builder/ -u tools:builder
git commit
Work time Rest time Full time Pure work Pure rest
1 20 5 00:25 00:20 00:05
2 20 5 00:50 00:40 00:10
3 20 5 01:15 01:00 00:15
4 20 15 01:50 01:20 00:30
5 20 5 02:15 01:40 00:35
6 20 5 02:40 02:00 00:40
7 20 5 03:05 02:20 00:45
8 20 15 03:40 02:40 01:00