Browse Source
Temperature i3block, 369-a4 functions
Temperature i3block, 369-a4 functions
Update git-add to add all changes instead of just current dir.red-hat-laptop
Kevin Mok
6 years ago
12 changed files with 58 additions and 84 deletions
-
18aliases/key_aliases
-
3fish/.config/fish/config.fish
-
3fish/.config/fish/functions/369/a4/mount-image.fish
-
15fish/.config/fish/functions/369/a4/revert-image.fish
-
8fish/.config/fish/functions/369/a4/run-a4.fish
-
2fish/.config/fish/functions/create-fish-function.fish
-
3fish/.config/fish/functions/grep-pdf.fish
-
4i3blocks/.config/i3blocks/i3blocks.conf
-
72i3blocks/.config/i3blocks/scripts/temperature
-
1txt/key_dirs.txt
-
2txt/key_files.txt
-
11vim/.vimrc
@ -0,0 +1,3 @@ |
|||
function mount-image |
|||
sudo mount $argv[1] /mnt/369-a4 |
|||
end |
@ -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 |
@ -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 |
@ -0,0 +1,3 @@ |
|||
function grep-pdf |
|||
pdfgrep -n $argv[1] -B $argv[2] -A $argv[3] (fd -e pdf --no-ignore-vcs) |
|||
end |
@ -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" |
Write
Preview
Loading…
Cancel
Save
Reference in new issue