Skip to content

Instantly share code, notes, and snippets.

View radlinskii's full-sized avatar

Radliński Ignacy radlinskii

  • u-blox
  • Zürich, Switzerland
View GitHub Profile
@radlinskii
radlinskii / README.md
Last active December 6, 2022 17:51
Config file for [Karabiner Elements](https://karabiner-elements.pqrs.org/) used for customizing keyboard layout on MacOS.

Config file for Karabiner Elements used for customizing keyboard layout on MacOS.

Profiles:

  • qwerty - default profile without any changes
  • qwerty with custom arrows - JKIL keys act as arrows when Capslock key is held. Section sign acts as caps
  • colemak dh - colemak mod dh keyboard layout
  • colemak dh with custom arrows - colemak dh with JKIL keys acting as arrows when Capslock key is held. Section sign acts as caps.
@radlinskii
radlinskii / git_branch_delete_all_but.sh
Last active April 4, 2022 08:45
Delete all the git branches but "master", "main", current branch, and every branch name you provide as argument.
#!/bin/sh
function git_branch_delete_all_but() {
branch_names_to_keep=("$@")
branch_names_to_keep+=("master") # do not delete master
branch_names_to_keep+=("main") # do not delete main
branch_names_to_keep+=$(git symbolic-ref --short -q HEAD) # do not delete current branch
branch_names_to_delete=()
@radlinskii
radlinskii / killp.sh
Created June 16, 2020 11:06
script for killing a process running on given port
# kill process running on given port
# argument: port number
# example usage:
# > killp 3000
function killp() {
local tmp
local exit_status
echo "looking for process running on port: $1"
tmp=$(lsof -i :"$1" | awk '{ print $2}' | grep "^[0-9][0-9]*$")
@radlinskii
radlinskii / git_clone_and_init_alias.sh
Last active March 22, 2020 23:01
git clone and git init alias that adds setting the git user name and email address after cloning or initializing the repo.
function set_git_config_variable() {
local defaultvalue="$(git config user.$1)"
local exit_status
echo "Please provide the repository config user $1 (default: $defaultvalue):"
read customvalue
if [ -z $customvalue ]; then
git config user.$1 $defaultvalue
exit_status=$?
#!/bin/sh
STAGED_GO_FILES=$(git diff --cached --name-only | grep ".go$")
if [[ "$STAGED_GO_FILES" = "" ]]; then
exit 0
fi
PASS=true
@radlinskii
radlinskii / pre-commit.sh
Last active November 6, 2024 10:03
pre-commit git hook file for Golang. Be sure to save this file in your repository as `.git/hooks/pre-commit` and give it right to execute e.g. with command `chmod +x .git/hooks/pre-commit`
#!/bin/sh
STAGED_GO_FILES=$(git diff --cached --name-only | grep ".go$")
if [[ "$STAGED_GO_FILES" = "" ]]; then
exit 0
fi
GOLINT=$GOPATH/bin/golint
GOIMPORTS=$GOPATH/bin/goimports