Skip to content

Instantly share code, notes, and snippets.

View kiselev-nikolay's full-sized avatar

Nikolay Kiselev kiselev-nikolay

View GitHub Profile
@kiselev-nikolay
kiselev-nikolay / git_stat.fish
Last active August 5, 2021 09:05
Get git stat by lines
#!/usr/bin/fish
function git_stat
for i in (git log --format='%aN' | sort -u)
printf "STAT %s%s%s\n" (set_color red) "$i" (set_color normal)
git log --author="$i" --pretty=tformat: --numstat | awk '{inserted+=$1; deleted+=$2; delta+=$1-$2; ratio=deleted/inserted} END {printf "STAT Commit stats:\nSTAT - Lines added (total).... %s\nSTAT - Lines deleted (total).. %s\nSTAT - Total lines (delta).... %s\nSTAT - Add./Del. ratio (1:n).. 1 : %s\n", inserted, deleted, delta, ratio }' -
echo
end
end
@kiselev-nikolay
kiselev-nikolay / config.fish
Last active July 8, 2021 05:05
Fish config which I put on my servers. Beautiful and requires nothing.
#
# Functions
#
function i
hostname -I | cut -d " " -f 1
end
function ut
sudo sh -c "timedatectl set-timezone Europe/Moscow && /usr/sbin/ntpdate pool.ntp.org"
@kiselev-nikolay
kiselev-nikolay / .bashrc
Created June 18, 2021 06:10
Bash prompt which I put on my servers. beautiful and requires nothing.
alias i='hostname -I | cut -d " " -f 1'
alias ll='ls -alah'
alias fuck='git update-index --assume-unchanged'
alias unfuck='git update-index --no-assume-unchanged'
function getPS1() {
EXIT_CODE=$?;
printf "\n$(tput setaf 0)$(tput setab 2) $USER@$(i) $(tput sgr 0)";
@kiselev-nikolay
kiselev-nikolay / domc.go
Last active May 15, 2021 11:04
Go cli script used to create go package or domain go package with mvc sub-packages
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"strings"
)
@kiselev-nikolay
kiselev-nikolay / todoist.sh
Created December 9, 2020 07:42
Todoist terminal intergration
token="YOUR_TODOIST_TOKEN_HERE"
nowt=$(expr $(date +%s) / 14400)
test -f /tmp/todoistTasks$nowt.json \
|| curl --silent -q https://api.todoist.com/sync/v8/sync \
-d token=$token \
-d sync_token='*' \
-d resource_types='["items"]' > /tmp/todoistTasks$nowt.json
printf "\033[1;32mTasks need to be done:\033[0m\n"