Skip to content

Commit

Permalink
modified scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
shivanshu-semwal committed Feb 24, 2024
1 parent ebcd1e3 commit d4e364d
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 58 deletions.
71 changes: 32 additions & 39 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
Expand Down Expand Up @@ -47,17 +40,17 @@ esac

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
color_prompt=yes
else
color_prompt=
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

# Use Starship
eval "$(starship init bash)"
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
Expand All @@ -75,30 +68,8 @@ esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'

#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases

[ -s "$HOME/Scripts/shell/alias-color.sh" ] && source "$HOME/Scripts/shell/alias-color.sh"
fi

# enable programmable completion features (you don't need to enable
Expand All @@ -112,6 +83,28 @@ if ! shopt -oq posix; then
fi
fi

#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/home/totoro/.sdkman"
[[ -s "/home/totoro/.sdkman/bin/sdkman-init.sh" ]] && source "/home/totoro/.sdkman/bin/sdkman-init.sh"
#########################################
# APPLICATIONS CONFIG #
#########################################

[ -s"$HOME/Scripts/shell/alias.sh" ] && source "$HOME/Scripts/shell/alias.sh"
[ -s"$HOME/Scripts/shell/functions.sh" ] && source "$HOME/Scripts/shell/functions.sh"
[ -s"$HOME/Scripts/shell/env.sh" ] && source "$HOME/Scripts/shell/env.sh"

# nvm
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

# sdkman
[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ] && source "$HOME/.sdkman/bin/sdkman-init.sh"

# fzf
[ -s "$HOME/.fzf.bash" ] && source ~/.fzf.bash

# autojump
[ -s "/usr/share/autojump/autojump.bash" ] && source /usr/share/autojump/autojump.bash

## cargo
[ -s "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"

# zprof
5 changes: 4 additions & 1 deletion .config/Code/User/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
// windows config
"window.menuBarVisibility": "toggle",
"window.restoreWindows": "none",
"window.autoDetectColorScheme": true,
// keyboard
"keyboard.dispatch": "keyCode",
// zenmode
Expand Down Expand Up @@ -119,7 +120,7 @@
// "--enable-config"
// ]
"clangd.path": "/home/totoro/.config/Code/User/globalStorage/llvm-vs-code-extensions.vscode-clangd/install/15.0.3/clangd_15.0.3/bin/clangd",
// prettier
// prettier
"prettier.printWidth": 100,
"rewrap.wrappingColumn": 100,
// vim extension
Expand Down Expand Up @@ -156,4 +157,6 @@
},
"git.openRepositoryInParentFolders": "never",
"editor.minimap.enabled": false,
"window.zoomLevel": 1,
"workbench.colorTheme": "Default Light Modern",
}
2 changes: 1 addition & 1 deletion .config/alacritty/alacritty.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import:
- /home/totoro/.config/alacritty/themes/alacritty_0_12.yaml
- /home/totoro/.config/alacritty/themes/atom_one_light.yaml

# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
Expand Down
30 changes: 30 additions & 0 deletions .config/fontconfig/conf.d/01-emoji.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- setting up emoji fonts as weak binding -->
<match>
<test name="family"><string>sans-serif</string></test>
<edit name="family" mode="prepend" binding="weak">
<string>Noto Color Emoji</string>
</edit>
</match>
<match>
<test name="family"><string>serif</string></test>
<edit name="family" mode="prepend" binding="weak">
<string>Noto Color Emoji</string>
</edit>
</match>
<match>
<test name="family"><string>monospace</string></test>
<edit name="family" mode="prepend" binding="weak">
<string>Noto Color Emoji</string>
</edit>
</match>
<match>
<test name="family"><string>Apple Color Emoji</string></test>
<edit name="family" mode="prepend" binding="weak">
<string>Noto Color Emoji</string>
</edit>
</match>
</fontconfig>

3 changes: 1 addition & 2 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ bindkey -s '^o' '^ulfcd\n'

# nvm
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/zsh_completion" ] && \. "$NVM_DIR/zsh_completion" # This loads nvm bash_completion

# sdkman
[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ] && source "$HOME/.sdkman/bin/sdkman-init.sh"
Expand All @@ -221,4 +220,4 @@ bindkey -s '^o' '^ulfcd\n'
## cargo
[ -s "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"

# zprof[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# zprof
15 changes: 9 additions & 6 deletions Scripts/basic/brightness
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
# read about it on archwiki(backlight)
# Author: totoro

CUR_BRI=$(cat /sys/class/backlight/intel_backlight/brightness)
MAX_BRI=$(cat /sys/class/backlight/intel_backlight/max_brightness)
BRIGHTNESS_FILE="/sys/class/backlight/intel_backlight/brightness"
MAX_BRIGHTNESS_FILE="/sys/class/backlight/intel_backlight/max_brightness"

CUR_BRI=$(cat "$BRIGHTNESS_FILE")
MAX_BRI=$(cat "$MAX_BRIGHTNESS_FILE")

# calculating 5 percent of max-brightness
((STEP = MAX_BRI * 5 / 100))
Expand All @@ -18,11 +21,11 @@ case $1 in
-inc)
((NEW_BRI = CUR_BRI + STEP))
if ((NEW_BRI < MAX_BRI)); then
echo $NEW_BRI | tee /sys/class/backlight/intel_backlight/brightness
echo $NEW_BRI | tee "$BRIGHTNESS_FILE"
((NEW_PER = NEW_BRI * 100 / MAX_BRI))
dunstify -a "Brightness" "Brightness" "Increase \nBrightness: " -h int:value:$NEW_PER -r 100 -i brightness-systray
else
echo $MAX_BRI | tee /sys/class/backlight/intel_backlight/brightness
echo $MAX_BRI | tee "$BRIGHTNESS_FILE"
dunstify -a "Brightness" "Brightness" "Increase \nBrightness: " -h int:value:100 -r 100 -i brightness-systray
fi
;;
Expand All @@ -31,9 +34,9 @@ case $1 in
((MIN_BRI = MAX_BRI * 10 / 100))
((NEW_BRI = CUR_BRI - STEP))
if ((NEW_BRI > MIN_BRI)); then
echo $NEW_BRI | tee /sys/class/backlight/intel_backlight/brightness
echo $NEW_BRI | tee "$BRIGHTNESS_FILE"
else
echo $MIN_BRI | tee /sys/class/backlight/intel_backlight/brightness
echo $MIN_BRI | tee "$BRIGHTNESS_FILE"
fi
((NEW_PER = NEW_BRI * 100 / MAX_BRI))
dunstify -a "Brightness" "Brightness" "Decrease \nBrightness: " -h int:value:$NEW_PER -r 100 -i brightness-systray
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions Scripts/basic/music → Scripts/basic/media-keys
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash

case $1 in
-next)
playerctl next --all-players
;;
-play-pause)
playerctl play-pause --all-players
# dbus-send --print-reply --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
;;
-previous)
playerctl previous --all-players
;;
-stop)
playerctl stop --all-players
;;
-next)
playerctl next --all-players
;;
-previous)
playerctl previous --all-players
;;
*)
exit 1
;;
Expand Down
4 changes: 1 addition & 3 deletions Scripts/basic/microphone
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/bash

# Use: Toggle the status of the default active mic source for pulseaudio
# Use: Toggle the status of the default active mic source for *pulseaudio*
# Dependencies: pactl, dunstify
# Description: mute, unmute active microphone
# Working:
# Author: Shivanshu

# Get active audio source index
Expand Down
78 changes: 78 additions & 0 deletions VSCode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Visual Studio Code

- config
- on linux `~/.config/Code`
- on windows `~/AppData/Roaming/Code/`

- `User` directory contains the config

## Extensions List

- C/C++ (Microsoft)
- Python (Microsoft)

### tex

- Latex Workshop
- <https://github.com/James-Yu/LaTeX-Workshop>

### Shell Scripting

- ShellCheck
- <https://github.com/vscode-shellcheck/vscode-shellcheck>
- ShellMan
- <https://github.com/yousefvand/shellman>

### Formatters

- Prettier
- shell-format
- <https://github.com/foxundermoon/vs-shell-format>

### Themes UI

- indent rainbow
- <https://github.com/oderwat/vscode-indent-rainbow>

### Markdown

- <https://github.com/markmap/markmap-vscode>
- <https://github.com/DavidAnson/vscode-markdownlint>
- <https://github.com/telesoho/vscode-markdown-paste-image>
- <https://github.com/yzhang-gh/vscode-markdown.git>

- you can style the headings individually using these

```json
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "heading.1.markdown entity.name.section.markdown, heading.1.markdown punctuation.definition.heading.markdown",
"settings": {
"foreground": "#de6a73",
"fontStyle": "bold"
}
},
{
"scope": "heading.2.markdown entity.name.section.markdown, heading.2.markdown punctuation.definition.heading.markdown",
"settings": {
"foreground": "#c678dd",
"fontStyle": "bold"
}
},
{
"scope": "heading.3.markdown entity.name.section.markdown, heading.3.markdown punctuation.definition.heading.markdown",
"settings": {
"foreground": "#98c379",
"fontStyle": "bold"
}
},
{
"scope": "heading.4.markdown entity.name.section.markdown, heading.4.markdown punctuation.definition.heading.markdown",
"settings": {
"foreground": "#e5c07a",
"fontStyle": "bold"
}
}
]
```

0 comments on commit d4e364d

Please sign in to comment.