Skip to content

Instantly share code, notes, and snippets.

Task Emacs Vim
Quit Editor with an error code (kill-emacs <exitcode>) :cq
Toggle whitespace visualization M-x whitespace-mode :set list!
vpetruchok /
Last active Nov 28, 2018
Show git refs ordered by committer date DESC

git for-each-ref --sort=-committerdate --format '%(objectname:short) %(objecttype) %(refname) | %(committerdate:relative)  %(if)%(authorname)%(then)(by %(authorname) %(authoremail))%(end)' "$@" | column  -t -s\|


Fields for the --format option

View ping-wrappers.ps1
function playNotificationSound() {
# From
$sound = New-Object System.Media.SoundPlayer;
function p() {
vpetruchok / lastCommandTime.ps1
Created Jul 10, 2017
PowerShell : Linux time command equivalent
View lastCommandTime.ps1
# from
function lastCommandTime() {
$command = Get-History -Count 1
return $command.EndExecutionTime - $command.StartExecutionTime
set-alias lct lastCommandTime
View powershell-repl-history.ps1
# from
$HistoryFilePath = Join-Path ([Environment]::GetFolderPath('UserProfile')) .ps_history
Register-EngineEvent PowerShell.Exiting -Action { Get-History | Export-Clixml $HistoryFilePath } | out-null
if (Test-path $HistoryFilePath) { Import-Clixml $HistoryFilePath | Add-History }

psql connection parameters

Parameter name Command line argurment Environment variable
Database name -d database $PGDATABASE
Hostname -h host $PGHOST
Port -p port $PGPORT
User name -U username $PGUSER

Usefull settings


Structural search

Find classes with the main method:

public static void main(String[] $param$);

vpetruchok /
Last active Oct 20, 2016
Intellij Idea Live Templates

IntelliJ Idea Live Templates

  • main

    public static void main(String[] args){
  • printf

vpetruchok /
Last active Mar 17, 2016
git diff --word-diff=plain
vpetruchok / git-merge-diff3.txt
Last active Mar 17, 2016
git merge.conflictStyle (diff3)
View git-merge-diff3.txt
# 3-way merge style
git config merge.conflictstyle diff3
# 2-way merge style (by default)
git config merge.conflictstyle merge