Add scripts, configurations, docs from borgcube

This commit is contained in:
Martin Blazik
2020-08-13 11:06:41 +02:00
parent fd7e36a457
commit 7f8b5ae43b
15 changed files with 207 additions and 3 deletions

30
README.md Normal file
View File

@@ -0,0 +1,30 @@
Linux Workspace
Repository of config files, scripts and other staff to quick configure new computer
Applications
- ~/bin/ scripts
- JetBrainsToolbox (download from jetbrains)
- zoom (snap)
Configurations
- IntelliJ IDEA
- bash aliases
- bash configuration
- vim configuration
- git global configuration (just script?), alises
- PowerShell aliases and configuration
Others
- list of deb packages (script for install)
- git bash support
https://github.com/magicmonty/bash-git-prompt
gw
https://github.com/To-da/gdub
Scripts
- add to PATH (not double)
Where to put specific applications?
$HOME/opt ?
or some

24
bin/git-reset-master Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
current_branch=$(git rev-parse --abbrev-ref HEAD)
git_workdir=$(git rev-parse --show-toplevel)
echo -n "CHECK master branch: "
if [[ "$current_branch" != "master" ]]; then
echo "BAD branch $current_branch"
exit 1
fi
echo "OK"
echo -n "CHECK root workdir: "
if [[ "$git_workdir" != "$PWD" ]]; then
echo "BAD"
exit 2
fi
echo "OK"
echo
echo "git fetch"
git fetch
echo "git reset --hard origin/master"
git reset --hard origin/master

9
bin/tss Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env python3
from sys import stdin, stdout
from time import time
start = time()
for line in stdin:
stamp = time() - start
stdout.write(f"{stamp:0.6f} {line}")

14
bin/wifi-power-off Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# https://unix.stackexchange.com/questions/269661/how-to-turn-off-wireless-power-management-permanently
# /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
# [connection]
# wifi.powersave = 2
#DEVICE=wlp0s20f3
DEVICE=$(ip route list default | awk '{ print $5 }')
echo "Device $DEVICE"
ip -c -4 addr show dev $DEVICE
iwconfig $DEVICE power off

11
bin/xmosh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
endpoint=$1
if [[ $endpoint == *:* ]]; then
host=${endpoint%:*}
port=${endpoint#*:}
mosh --ssh="ssh -p $port" $host
else
mosh $endpoint
fi

View File

@@ -0,0 +1,5 @@
# PowerShell profile script
Set-Alias ps Get-Process
Set-Alias kill Stop-Process

49
conf/gnome-shortcuts.conf Normal file
View File

@@ -0,0 +1,49 @@
[/]
calculator=['<Super>c']
control-center=['<Shift><Super>s']
custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6/']
decrease-text-size=['<Super>minus']
help=['<Super>h']
increase-text-size=['<Super>equal']
next=['<Alt><Super>Right']
play=['<Alt><Super>space']
previous=['<Alt><Super>Left']
search=['<Super>f']
volume-down=['<Alt><Super>Down']
volume-up=['<Alt><Super>Up']
www=['<Super>b']
[custom-keybindings/custom0]
binding='<Primary><Alt><Super>s'
command='/bin/systemctl suspend'
name='Sleep'
[custom-keybindings/custom1]
binding='<Shift><Super>l'
command='gnome-session-quit --logout'
name='Log out'
[custom-keybindings/custom2]
binding='<Super>i'
command='gnome-terminal -e pwsh'
name='PowerShell Terminal'
[custom-keybindings/custom3]
binding='<Alt><Super>KP_5'
command='/home/lachtan/bin/winmix.py 5'
name='winmix middle'
[custom-keybindings/custom4]
binding='<Alt><Super>KP_4'
command='/home/lachtan/bin/winmix.py 4'
name='winmix left'
[custom-keybindings/custom5]
binding='<Alt><Super>KP_6'
command='/home/lachtan/bin/winmix.py 6'
name='winmix right'
[custom-keybindings/custom6]
binding='<Alt><Super>KP_0'
command='/home/lachtan/bin/winmix.py 0'
name='winmix reset'

3
conf/packages.txt Normal file
View File

@@ -0,0 +1,3 @@
# list of debian packages to install
curl
mc less vim tcpdump hwinfo

4
doc/idea.txt Normal file
View File

@@ -0,0 +1,4 @@
Detekt configuration
$NAS_PROJECT/gradle/scripts/detekt-config.yml

24
doc/toda-git-tips.txt Normal file
View File

@@ -0,0 +1,24 @@
git la
la=!git config -l | grep alias | cut -c 7-
undo-commit=reset --soft HEAD^
c=commit -m
a=add .
cob=checkout -b
s=status
um=!git fetch upstream && git rebase upstream/master
ud=!git fetch upstream && git rebase upstream/develop
ls=log --oneline
caa=commit -a --amend -C HEAD
ca=commit --amend
sl=stash list
sa=stash apply
ss=stash save
recent=!git for-each-ref --sort='-committerdate' --format='°%(committerdate)%09%09%(refname)' refs/heads
last=!git for-each-ref --sort='-committerdate' --format='°%(committerdate)%09%09%(refname)' refs/heads

View File

@@ -1,2 +0,0 @@
curl
mc less vim tcpdump hwinfo

7
scripts/git-config.sh Normal file → Executable file
View File

@@ -6,7 +6,12 @@ git config --global user.email martin.blazik@gooddata.com
git config --global core.editor vim
git config --global alias.co checkout
git config --global alias.cob "checkout -b"
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage "reset HEAD --"
git config --global alias.ls "log --oneline"
git config --global alias.aliases "config --get-regexp alias"
git config --global alias.configs "config --list"
git config --global alias.undo-commit "reset --soft HEAD^"

0
scripts/git-prompt-install.sh Normal file → Executable file
View File

19
scripts/gnome-shortcuts.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
# https://unix.stackexchange.com/questions/119432/save-custom-keyboard-shortcuts-in-gnome
set -o
CONF=conf/gnome-shortcuts.conf
CONF_PATH=/org/gnome/settings-daemon/plugins/media-keys/
function dump() {
dconf dump $CONF_PATH > $CONF
}
function load() {
dconf load $CONF_PATH < $CONF
}
# zvol operaci

View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -o
PWSH_PROFILE_NAME=Microsoft.PowerShell_profile.ps1
PWSH_PROFILE_PATH=$HOME/.config/
cp config/$PWSH_PROFILE_NAME $PWSH_PROFILE_PATH