Browse Source

New utils

* Tile pdf eg: Tile A5 in A4 page
* Start / stop pulseaudio tcp
* systemd service generator
pull/17/head
Harish Karumuthil 3 years ago
parent
commit
33010333a7
  1. 2
      home/.config/alacritty/alacritty.yml
  2. 11
      home/.config/sway/config
  3. 43
      home/.local/Apps/daily-utils/bin/hari-tools.sh

2
home/.config/alacritty/alacritty.yml

@ -2,7 +2,7 @@ font:
size: 13.0
normal:
# family: Source Code Pro Medium
family: CodeNewRoman Nerd Font Mono
family: DejaVuSansMono Nerd Font Mono
key_bindings:
- { key: Return, mods: Shift, chars: "\e[13;2u" }

11
home/.config/sway/config

@ -14,7 +14,8 @@ set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term gnome-terminal
# set $term gnome-terminal
set $term konsole
# Your preferred application launcher
set $menu dmenu_run
@ -62,7 +63,7 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# reload the configuration file
@ -189,7 +190,9 @@ bindsym $mod+r mode "resize"
#
# Read `man 5 sway-bar` for more information about this section.
bar {
status_command i3status
#status_command i3status
swaybar_command waybar
status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
position top
colors {
statusline #ffffff
@ -201,7 +204,7 @@ bar {
include /etc/sway/config.d/*
set $wp_switch ~/.local/bin/sway-wp-switch
set $wp_switch sway-wp-switch
bindsym Control+Shift+Alt+Up exec $wp_switch -m up
bindsym Control+Shift+Alt+Down exec $wp_switch -m down

43
home/.local/Apps/daily-utils/bin/hari-tools.sh

@ -195,7 +195,7 @@ chromewayland(){
# pidEnv <PID> . Print environment variables of a PID.
pidEnv(){
cat /proc/$(pgrep kwin)/environ | tr '\0' '\n' | awk '{ print "export "$0}'
cat /proc/$(pgrep $1)/environ | tr '\0' '\n' | awk '{ print "export "$0}'
}
# Copy files from local to remote
@ -220,12 +220,49 @@ json2csv(){
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv'
}
# pdfTile <input file> <nup 2x1>
# pdfTile <input file> <nup 2x1> [options]
# Tile input pdf in A4 sheet
pdfTile(){
pdfjam $1 --no-landscape --nup $2 --paper a4paper --suffix A4
local infile=$1
shift
local nup=$1
shift
pdfjam $infile --nup $nup --paper a4paper --suffix A4 $@
}
# servicegen <name> <exec> [logsdir]
# Generate systemd service file
servicegen(){
local name=$1
local cmd=$2
local logsdir=$3
cat<<EOF
[Unit]
Description = $name
[Service]
Type = simple
LimitNOFILE = 4096
Restart = always
RestartSec = 2s
StandardOutput = append:$logsdir/stdout.log
StandardError = append:$logsdir/stderr.log
ExecStart = $cmd
[Install]
WantedBy = multi-user.target
EOF
}
# Start pulseaudio in tcp port 24667 to use with docker containers
pulseTcpStart(){
pactl load-module module-native-protocol-tcp port=24667 auth-ip-acl=172.16.0.0/12
}
# Stop pulseaudio in tcp port 24667
pulseTcpStop(){
pactl unload-module module-native-protocol-tcp
}
# Setup autocomplete. run eval "$(THIS_FILE setup-autocomplete)"
setup-autocomplete(){

Loading…
Cancel
Save