Skip to content

Instantly share code, notes, and snippets.

View n1kk's full-sized avatar
⌨️
Typity type type...

n1kk n1kk

⌨️
Typity type type...
  • Ubisoft / Massive
  • Malmö
View GitHub Profile
@n1kk
n1kk / .editorconfig
Last active November 6, 2021 12:29
My default repo configs
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
@n1kk
n1kk / set_max_input_volume.md
Last active September 13, 2021 18:20
How to crank input mic volume beyond max on linux

Find the index of the input device

Run alsamixer (or alsamixer -c 1 if you get errors) and set mic boost there to some unique value, like 96% (-1,00 db).

You can also change a setting in the gnome menu and try to find it in the listing of pactl list.

Now run this command but replace the value with yours

export VAL=96%; pactl list | sed -n "/^Source #/{x; /$VAL/p; d; }; /$VAL/H;"
@n1kk
n1kk / starship.toml
Last active December 19, 2021 14:16
Starship prompt config
format = """$status\
$username\
$hostname\
$shlvl\
$kubernetes\
$directory\
$vcsh\
$git_branch\
$git_commit\
$git_state\
@n1kk
n1kk / git-aliases.sh
Last active November 22, 2021 09:41
my git aliases
# list all aliases
git config --global alias.ls-alias 'config --get-regexp alias'
# load ssh agent for this session to not enter key password every time
# actually they don't work via git aliases, you have to put it in your .bashrc
git config --global alias.ssh-agent \!"eval \`ssh-agent\`; ssh-add"
git config --global alias.sa ssh-agent
# puch local only branch to origin and create there remote branch with same name
git config --global alias.publish push -u origin HEAD
@n1kk
n1kk / resync-time.bat
Last active May 29, 2020 08:01
Force windows to update time
REM *** run as ADMINISTRATOR !
REM Forces windows to update time
@echo off
set retryCount=0
echo Resync END
:SyncStart
if %retryCount% == 10 goto SyncFailed
@n1kk
n1kk / count-lines.ini
Last active June 2, 2022 21:33
script to print out git diff line changes per specific files category
[code]
code = /(src|styles)\/.*\.(jsx?|tsx?|[sp]?css|vue|html)/
# exclude
specs = !/\.specs?\./
tests = !/\s*tests\//
[tests]
specs = /\.specs?\./
tests = /^tests\//
@n1kk
n1kk / bash-arguments-parsing.sh
Last active May 25, 2020 23:17
ways to loop through script and function arguments
# looping over all argumetns while shifting the arguments array
function looping-over-all-arguments-destructive() {
while [[ $# -gt 0 ]];
do
opt="$1";
shift; #expose next argument
case "$opt" in
"--file" )
INCLUDE=$1;
shift;;
@n1kk
n1kk / uk-layout-tilda-key-swap.sh
Created March 10, 2019 23:16
Script to swap tilde (`/~) and paragraph (§/±) keys on UK layout keyboards in MacOS
#! /bin/bash
# this script should be run on login
# this swapps `/~ and §/± key on uk layout
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035},{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064}]}'
@n1kk
n1kk / get-apps-bundle-id.sh
Created March 10, 2019 23:12
Prints the bundle identifier for a given app in macOS
#! /bin/bash
get_apps_bundle_id() {
local name=$1
[[ -z $name ]] && { return; }
if [ ! -d "$name" ]; then
name=/Applications/${name}.app
if [ ! -d "$name" ]; then
return;
fi
@n1kk
n1kk / stress_cpu.sh
Last active February 2, 2019 01:24
stress test cpu on osx
function stress_cpu() {
for I in `seq 1 $(getconf _NPROCESSORS_ONLN)`
do
yes > /dev/null &
done
echo "Press enter to stop"
read
killall yes
}