Skip to content

Instantly share code, notes, and snippets.

@DmitryKorlas
DmitryKorlas / git-oneliners.md
Last active February 28, 2025 11:11
Few git one-liners

Output a count of changed lines of code (LoC) before commit per file

git diff --numstat | awk '{added+=$1; deleted+=$2; print $1+$2 "\t lines changed\t" $3 } END {print "\nTotal lines added: " added "\nTotal lines deleted: " deleted}' | sort -rn

output example:

286      lines changed  src/foo/bar.py
76       lines changed  src/foo/buz.py
6        lines changed  README.md
Total lines deleted: 78
@DmitryKorlas
DmitryKorlas / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

This notes as a reminder about how to install few useful packages

Installing (node|io)js package manager

$ sudo npm cache clean -f
$ sudo npm install -g n
$ sudo n stable
$ node -v

Youtube ASCII player

$ youtube-dl http://www.youtube.com/watch?v=yMf7KJHtweM -o - | mplayer -vo aa -monitorpixelaspect 0.5 -

Share unix folder into the win network

Firstly you have to install samba

sudo apt-get install samba

Then you have to configure samba config and add network folders

0. Share folder from Your home dir

add this section into /etc/samba/smb.conf

[Public]
@DmitryKorlas
DmitryKorlas / u-fixes.md
Last active August 29, 2015 14:19
Few fixes for ubuntu

Few fixes for work machine

Fix meld running in case of dbus message "GConf-WARNING **: Client failed to connect to the D-BUS daemon"

eval $(dbus-launch --sh-syntax)

export DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_PID

Fix remmina "Unable To Connect To RDP"

@DmitryKorlas
DmitryKorlas / ubuntu-tweaks.md
Last active June 22, 2016 14:28
ubuntu few tweaks

Setup remote desktop access

sudo apt-get install xfce4
echo xfce4-session >~/.xsession

Then make new remote desktop connection, choose "sesman-Xvnc" in options

============================================================

Improve performance for SSD drive

@DmitryKorlas
DmitryKorlas / oneliners.md
Last active June 30, 2021 11:30
Few commands for regular work (^.^) (`-`) (*.*)

Find legacy chains in code

This oneliner solve the following task. Say we know the list of methods which usages was modified in code.
OldLib.packageFoo.bar.methodBuz(); or AnotherLib.foo.methodBar(); was replaced to new call NEW.static.methodBuz() and NEW.static.methodBar(). We have a long list of methods in targets.sorted.txt and we would like to check if there are no old calls left on our large codebase.

$ cat /tmp/targets.sorted.txt
methodBuz
methodBar
$ cat /tmp/targets.sorted.txt | xargs -I {} sh -c "grep --include=\*.js -Ri -E 'NEW[a-zA-Z0-9.]+[^c]\.{}\(' ./"
@DmitryKorlas
DmitryKorlas / designer.html
Last active August 29, 2015 14:12
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">