Browse Source

Temperature i3block, 369-a4 functions

Update git-add to add all changes instead of just current dir.
red-hat-laptop
Kevin Mok 5 years ago
parent
commit
e51c007a78
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 18
      aliases/key_aliases
  2. 3
      fish/.config/fish/config.fish
  3. 3
      fish/.config/fish/functions/369/a4/mount-image.fish
  4. 15
      fish/.config/fish/functions/369/a4/revert-image.fish
  5. 8
      fish/.config/fish/functions/369/a4/run-a4.fish
  6. 2
      fish/.config/fish/functions/create-fish-function.fish
  7. 3
      fish/.config/fish/functions/grep-pdf.fish
  8. 4
      i3blocks/.config/i3blocks/i3blocks.conf
  9. 72
      i3blocks/.config/i3blocks/scripts/temperature
  10. 1
      txt/key_dirs.txt
  11. 2
      txt/key_files.txt
  12. 11
      vim/.vimrc

18
aliases/key_aliases

@ -24,7 +24,7 @@ ba "bat *"
grep "grep --color=auto -n"
grr "grep -r"
# pk "pkill -f"
cld "colordiff -y --suppress-common-lines"
cld "colordiff -wy --suppress-common-lines"
mkpk "makepkg -sri"
ex "chmod 777"
@ -234,11 +234,11 @@ gro "git remote show origin"
# add/remove {{{ #
ga "git add -A . && git status -u"
gac "git add -A . && git commit -S"
ga "git add -A && git status -u"
gac "git add -A && git commit -S"
gaf "git add -f"
# unsigned commt
gacu "git add -A . && git commit"
gacu "git add -A && git commit"
grm "git rm"
grmf "git rm -f"
@ -276,11 +276,11 @@ gstp "git stash pop"
gc "git commit -S"
gcu "git commit"
gca "git add -A . && git commit --amend --no-edit -S"
gcam "git add -A . && git commit --amend -S"
# gcamp "git add -A . && git commit --amend --no-edit -S && gpsf"
gca "git add -A && git commit --amend --no-edit -S"
gcam "git add -A && git commit --amend -S"
# gcamp "git add -A && git commit --amend --no-edit -S && gpsf"
psgi "git add . && git commit -m 'Update' -S && git push"
psgi "git add -A && git commit -m 'Update' -S && git push"
gps "git push"
gpsi "git config credential.helper store && git push"
# gpsn "git push --set-upstream origin master"
@ -393,6 +393,8 @@ rms "rm swapfile.*"
wl6 "watson log --all --project=369 --tag=a4"
wr6 "watson report --all --project=369 --tag=a4"
um6 "sudo umount /mnt/369-a4"
# a2 {{{ #
mcr "bear make clean && printf '\033c' && bear make && ./carsim light 1 20"

3
fish/.config/fish/config.fish

@ -32,7 +32,7 @@ abbr rfs "sync-shortcuts && source ~/.config/fish/config.fish"
abbr xf "fish_config"
abbr f. "cd .."
abbr f.. "cd ../.."
abbr mt "math ''"
abbr mt "math"
# }}} fish-specific #
@ -76,6 +76,7 @@ abbr grmb "git-delete-branch"
# }}} git #
abbr hs "scan-history"
abbr hst "$EDITOR ~/.local/share/fish/fish_history"
abbr pgr "grep-pdf"
abbr ut "unix-timestamp"
abbr uzr "unzip-rm"

3
fish/.config/fish/functions/369/a4/mount-image.fish

@ -0,0 +1,3 @@
function mount-image
sudo mount $argv[1] /mnt/369-a4
end

15
fish/.config/fish/functions/369/a4/revert-image.fish

@ -0,0 +1,15 @@
function revert-image
set img_file 'emptydisk.img'
switch $argv[1]
case 1
set img_file 'onefile.img'
case m
set img_file 'multilevel.img'
case l
set img_file 'largefile.img'
case s
set img_file 'symlink.img'
end
cp imgs{-cp,}/$img_file
end

8
fish/.config/fish/functions/369/a4/run-a4.fish

@ -12,17 +12,23 @@ function run-a4
set img_file 'imgs/multilevel.img'
case l
set img_file 'imgs/largefile.img'
case s
set img_file 'imgs/symlink.img'
end
switch $argv[1]
case h
./ext2_helpers_tester 'imgs/multilevel.img' '/level1/level2/bfile'
./ext2_helpers_tester $img_file
case hg
gdb -ex "run" -ex "bt" -ex "q" \
--args ./ext2_helpers_tester './imgs/multilevel.img' '/level1/level2/level3//'
case m
./ext2_mkdir $img_file '/'
# ./ext2_mkdir 'imgs/multilevel.img' '/level1/level2/bfile'
case rg
./readimage $img_file
gdb -ex "run" -ex "bt" -ex "q" \
--args ./readimage './imgs/symlink.img'
case '*'
./readimage $img_file
end

2
fish/.config/fish/functions/create-fish-function.fish

@ -1,5 +1,5 @@
function create-fish-function
printf 'function %s\n \nend' $argv[1] > $fish_fxn_dir/$argv[1].fish
printf 'function %s\nend' $argv[1] > $fish_fxn_dir/$argv[1].fish
and cd $fish_fxn_dir
and $EDITOR $argv[1].fish
end

3
fish/.config/fish/functions/grep-pdf.fish

@ -0,0 +1,3 @@
function grep-pdf
pdfgrep -n $argv[1] -B $argv[2] -A $argv[3] (fd -e pdf --no-ignore-vcs)
end

4
i3blocks/.config/i3blocks/i3blocks.conf

@ -39,6 +39,10 @@ WIDTH=220
# interval=5
# color=#990000
[temperature]
label=
interval=5
# [cpu_usage -w 50 -c 80]
[cpu_usage]
label=

72
i3blocks/.config/i3blocks/scripts/temperature

@ -1,69 +1,7 @@
#!/usr/bin/perl
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
# Copyright 2014 Benjamin Chretien <chretien at lirmm dot fr>
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
. "/home/kevin/.cache/wal/colors.sh"
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use utf8;
use Getopt::Long;
binmode(STDOUT, ":utf8");
# default values
my $t_warn = 70;
my $t_crit = 90;
my $chip = "";
my $temperature = -9999;
sub help {
print "Usage: temperature [-w <warning>] [-c <critical>] [--chip <chip>]\n";
print "-w <percent>: warning threshold to become yellow\n";
print "-c <percent>: critical threshold to become red\n";
print "--chip <chip>: sensor chip\n";
exit 0;
}
GetOptions("help|h" => \&help,
"w=i" => \$t_warn,
"c=i" => \$t_crit,
"chip=s" => \$chip);
# Get chip temperature
open (SENSORS, "sensors -u $chip |") or die;
while (<SENSORS>) {
if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) {
$temperature = $1;
last;
}
}
close(SENSORS);
$temperature eq -9999 and die 'Cannot find temperature';
# Print short_text, full_text
print "$temperature°C\n" x2;
# Print color, if needed
if ($temperature >= $t_crit) {
print "#FF0000\n";
exit 33;
} elsif ($temperature >= $t_warn) {
print "#FFFC00\n";
}
exit 0;
temps="$(sensors | rg 'temp1:.*' | awk '{ print $2 }' | rg -o '\d{2}' | \
sed 's/$/°C/' | tr '\n' ' ' | xargs)"
printf "%s\n\n%s\n" "$temps" "$color7"

1
txt/key_dirs.txt

@ -54,6 +54,7 @@ e3 /home/kevin/school/309/e3
# 369
6 /home/kevin/school/369
6l /home/kevin/school/369/notes/lectures
6m /mnt/369-a4
6f /home/kevin/linux-config/fish/.config/fish/functions/369/a3
a4d /home/kevin/school/369/a4/a4

2
txt/key_files.txt

@ -32,7 +32,7 @@ ne /home/kevin/linux-config/configs/neofetch/config.conf
re README.md
td todo.md
tm /home/kevin/.vim/plugged/vim-snippets/UltiSnips/texmath.snippets
wh /home/kevin/Documents/journal/work-habit.md
wh /home/kevin/Documents/journal/todo/work-habit.md
wt /home/kevin/.config/watson/state.tmp
# }}} cdn *

11
vim/.vimrc

@ -247,7 +247,6 @@ nnoremap <C-w> <C-W>|
" leader mappings {{{ "
let mapleader="\<Space>"
" let maplocalleader="-"
" find alias
nnoremap <leader>a /^ <Left>
@ -281,6 +280,10 @@ nnoremap <leader>h :set hlsearch! hlsearch?<CR>
nnoremap <leader>he :help
nnoremap <leader>ht :set tabstop=2 shiftwidth=2 expandtab<CR>
nnoremap <leader>vhe :vert help
" format current line
nnoremap <leader>l Vgq
" format this and next line
nnoremap <leader>ll Vjgq
" move cursor to middle of line
nnoremap <leader>m :call cursor(0, len(getline('.'))/2)<CR>
" apply normal command to selection
@ -319,10 +322,6 @@ nnoremap <leader>sys :set syn=sh<CR>
vnoremap <leader>t :!tac<CR>
" open vimrc in vertical split
nnoremap <leader>vv :vsp ~/.vimrc<CR>
" format current line
nnoremap <leader>ww Vgq
" format this and next line
nnoremap <leader>www Vjgq
" copy next thing to system clipboard
" nnoremap <leader>y "+
" nnoremap <leader>Y "+Y
@ -380,6 +379,8 @@ autocmd Filetype tex inoremap <localleader>tx $t(x)$
autocmd Filetype c inoremap <localleader>uc unsigned char
autocmd BufNewFile,BufRead *.h nnoremap <localleader>x 0iextern <Esc>f{hc$;<Esc>
autocmd Filetype fish inoremap <localleader>1 $argv[1]
autocmd Filetype fish inoremap <localleader>2 $argv[2]

Loading…
Cancel
Save