Skip to content

Instantly share code, notes, and snippets.

@nikgalushko
nikgalushko / guide.md
Created Nov 4, 2021
7 steps to configure local system for playing with Golang generics before go 1.18
View guide.md

Install gotip

go install golang.org/dl/gotip@latest
gotip download

Install latest gopls

mkdir /tmp/gopls && cd "$_"
gotip mod init gopls-unstable
View git-stats.sh
for name in $(git log --pretty="%ae%n%cn" | sort | uniq); do
git log \
--author "$name" \
--pretty=tformat: --numstat |
awk -v name="$name" '{
add += $1; subs += $2; loc += $1 - $2
} END {
if (loc != 0)
printf "[%s] Lines: +\033[32m%s\033[0m -\033[31m%s\033[0m; Total: %s\n", name, add, subs, loc
}'
View gist:dd5e2f9ad4c19b3e552631c364e90fc9
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go'
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
Plug 'preservim/nerdtree'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-fugitive'
Plug 'morhetz/gruvbox'
Plug 'NLKNguyen/papercolor-theme'
View cpp lexicographical_compare
lexicographical_compare(
// ... все символы строки l ...
begin(l), end(l),
// ... со всеми символами строки r ...
begin(r), end(r),
// ..., используя в качестве компаратора сравнение отдельных символов без учёта регистра
[](char cl, char cr) { return tolower(cl) < tolower(cr); }
);
@nikgalushko
nikgalushko / signal.go
Created Feb 18, 2020 — forked from reiki4040/signal.go
signal handling example for golang
View signal.go
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {
@nikgalushko
nikgalushko / squash.txt
Last active Feb 18, 2019
Squash all commits in branch
View squash.txt
git checkout yourBranch
git reset $(git merge-base master yourBranch)
git add -A
git commit -m "one commit on yourBranch"
@nikgalushko
nikgalushko / move-stashes.md
Created Dec 29, 2018 — forked from alexeds/move-stashes.md
Move your stashes from one repo to another
View move-stashes.md

Move your stashes from one repo to another


This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.

Download your stashes

git stash show -p > patch

You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.

View webpack example config
'use strict';
const NODE_ENV = process.env.NODE_ENV || "development"; //переменная окружения нужная для переключения между dev/prod
const webpack = require('webpack');
module.exports = {
context: __dirname + "/frontend", //указывается root, где искать файлы для entry
entry: { //объект, когда несколько точек входа. строка, когда одна
home: "./home",
about: "./about",
View vscode keybindings.json
// Поместите настраиваемые сочетания клавиш в этот файл, чтобы перезаписать клавиши по умолчанию.
[
{
"key": "shift+cmd+-",
"command": "editor.foldAll",
"when": "editorTextFocus"
},
{
"key": "cmd+k cmd+0",
"command": "-editor.foldAll",
View vscode user settings
{
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"window.zoomLevel": 0,
"explorer.confirmDelete": false,
"editor.tabCompletion": true,
"explorer.confirmDragAndDrop": false
}