diff options
Diffstat (limited to 'local/bin')
-rwxr-xr-x | local/bin/asus-fan | 28 | ||||
-rwxr-xr-x | local/bin/email-unread | 33 | ||||
-rwxr-xr-x | local/bin/mxrandr | 119 | ||||
-rwxr-xr-x | local/bin/project-test | 43 | ||||
-rwxr-xr-x | local/bin/steam | 10 | ||||
-rwxr-xr-x | local/bin/system-backup | 75 | ||||
-rwxr-xr-x | local/bin/vim-project-gen | 4 |
7 files changed, 0 insertions, 312 deletions
diff --git a/local/bin/asus-fan b/local/bin/asus-fan deleted file mode 100755 index 09e54f1..0000000 --- a/local/bin/asus-fan +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# TODO this probably should be auto detected, because hwmon number can change -HWMON=/sys/devices/platform/asus-nb-wmi/hwmon/hwmon1 - -if [ "$(whoami)" != "root" ]; then - echo "Run $0 only with root privileges" - exit -1 -fi - -case "$1" in - -h|--help) - echo "Usage: $0 -h|full|auto" - echo "This script controls asus hwmon" - echo " full - Full throttle" - echo " auto - Automatic hardware control" - ;; - full) - echo 1 > $HWMON/pwm1_enable - echo 255 > $HWMON/pwm1 - ;; - auto) - echo 0 > $HWMON/pwm1_enable - ;; - *) - echo "Unknown or no option given!" - exit -2 - ;; -esac diff --git a/local/bin/email-unread b/local/bin/email-unread deleted file mode 100755 index dec7d04..0000000 --- a/local/bin/email-unread +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use File::Find; - -use constant EMAIL => glob("~/.mail"); -my $IGNORE = "(Spam|trash|Important)"; - -my $V = (shift || "") eq "-s"; - -opendir(EDIR, EMAIL) or die $!; -while (readdir EDIR) { - next if /^\./ or not (-d EMAIL."/$_"); - our $count = 0; - - sub new_dir { - my $path = substr $File::Find::name, 1 + length EMAIL; - $path =~ s/\/new$//; - return if $_ ne "new" or $path =~ /$IGNORE/; - my $cnt = 0; - opendir(NDIR, "$File::Find::name") or die $!; - while (readdir NDIR) { - $cnt += 1 unless /^\./; - } - closedir(NDIR); - print "$path: $cnt\n" if not $V and $cnt > 0; - $count += $cnt; - } - find(\&new_dir, EMAIL."/$_"); - - print "$_: $count\n" if $V and $count > 0; -} -closedir(EDIR); diff --git a/local/bin/mxrandr b/local/bin/mxrandr deleted file mode 100755 index 81ae511..0000000 --- a/local/bin/mxrandr +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash - -# get info from xrandr -connectedOutputs=$(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") -activeOutput=$(xrandr | grep -E " connected (primary )?[1-9]+" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") -disconnectedOutputs=$(xrandr | grep -E " disconnected (primary )?[1-9]+" | awk '{print $1}') - -cmd="xrandr " -cmd_def=$cmd - -INTERNAL=eDP-1 -HDMI=HDMI-1 -VGA=VGA-1 - -for device in "$disconnectedOutputs"; do - if [ -n "$defice" ]; then - if [[ "$activeOutput" == *"$device"* ]]; then - cmd=$cmd" --output $device --off" - fi - fi -done - -function only_internal { - cmd=$cmd" --output $INTERNAL --auto --primary" - cmd=$cmd" --output $HDMI --off" - cmd=$cmd" --output $VGA --off" -} - -function internal_vga { - cmd=$cmd" --output $INTERNAL --auto --primary" - cmd=$cmd" --output $HDMI --off" - cmd=$cmd" --output $VGA --auto --right-of $INTERNAL" -} - -function internal_hdmi { - cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI" - cmd=$cmd" --output $HDMI --auto --primary" - cmd=$cmd" --output $VGA --off" -} - -function internal_hdmi_vga { - cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI" - cmd=$cmd" --output $HDMI --auto --primary" - cmd=$cmd" --output $VGA --auto --left-of $HDMI" -} - -function cmd_exec { - if [ "$cmd" != "$cmd_def" ]; then - echo $cmd - `$cmd` - fi -} - - -if [ $# -le 1 ]; then - if [[ "$connectedOutputs" == *"$HDMI"* ]]; then - if [[ "$connectedOutputs" == *"$VGA"* ]]; then - internal_hdmi_vga - else - internal_hdmi - fi - else - if [[ "$connectedOutputs" == *"$VGA"* ]]; then - internal_vga - else - only_internal - fi - fi - cmd_exec - exit -fi - -if [ "$2" != "mode" ]; then - if [[ "$connectedOutputs" != *"$2"* ]]; then - echo No $2 display known - exit - fi -fi - -case "$1" in - toggle) - case "$2" in - $INTERNAL) - if [[ "$activeOutput" == *"$INTERNAL"* ]]; then - cmd=$cmd" --output $INTERNAL --off" - else - if [[ "$activeOutput" == *"$HDMI"* ]]; then - cmd=$cmd" --output $INTERNAL --auto --right-of $HDMI" - else - cmd=$cmd" --output $INTERNAL --auto --primary" - fi - fi - ;; - $HDMI) - if [[ "$activeOutput" == *"$HDMI"* ]]; then - cmd=$cmd" --output $HDMI --off" - else - if [[ "$activeOutput" == *"$VGA"* ]]; then - cmd=$cmd" --output $HDMI --auto --primary" - else - cmd=$cmd" --output $HDMI --auto --right-of $INTERNAL" - fi - fi - ;; - $VGA) - if [[ "$activeOutput" == *"$VGA"* ]]; then - cmd=$cmd" --output $VGA --off" - else - if [[ "$activeOutput" == *"$HDMI"* ]]; then - cmd=$cmd" --output $VGA --auto --left-of $HDMI" - else - cmd=$cmd" --output $VGA --auto --right-of $INTERNAL" - fi - fi - ;; - esac - ;; -esac -cmd_exec diff --git a/local/bin/project-test b/local/bin/project-test deleted file mode 100755 index a0591d8..0000000 --- a/local/bin/project-test +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# Executes given command on all commits from current one to given one. -set -e - -print_help() { - echo "Executes given command for each commit. In default it executes" - echo "for 10 previous commands." - echo - echo "Usage: project-test [OPTION...] [--] COMMAND" - echo " -r,--ref [REF]" - echo " Git reference to go to" - echo " -c,--count [COUNT]" - echo " Tests given count of references back from current one." -} - -while [ -n "$1" ]; do - case $1 in - -r|--ref) - shift - REF=$1 - ;; - -c|--count) - shift - REF=HEAD~$1 - ;; - --) - shift - break - ;; - *) - break - ;; - esac - shift -done - -[ -n "$REF" ] || REF=HEAD~10 - -while read -r rev; do - git checkout "$rev" - git submodule update - eval $@ -done < <(git rev-list "$REF"..HEAD) diff --git a/local/bin/steam b/local/bin/steam deleted file mode 100755 index b573daf..0000000 --- a/local/bin/steam +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -#export STEAM_RUNTIME=0 -export STEAM_RUNTIME_PREFER_HOST_LIBRARIES=0 -# Workaround for dbus fatal termination related coredumps (SIGABRT) -# https://github.com/ValveSoftware/steam-for-linux/issues/4464 -export DBUS_FATAL_WARNINGS=0 -# Override some libraries as these are what games linked against. -export LD_LIBRARY_PATH="/usr/lib/steam:/usr/lib32/steam" -#export LD_PRELOAD="/usr/lib/steam:/usr/lib32/steam /usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.4/libstdc++.so.6 /usr/lib64/gcc/x86_64-pc-linux-gnu/4.9.4/libgcc_s.so.1 /usr/lib64/libxcb.so.1 /usr/lib64/libgpg-error.so" -exec /usr/bin/steam "$@" diff --git a/local/bin/system-backup b/local/bin/system-backup deleted file mode 100755 index dfa2c09..0000000 --- a/local/bin/system-backup +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# vim:ft=sh -# New line separated list of all directories to backup -DIRS="/etc -/home -/home_hdd" -# Name of the machine used in backup subvolumes -MNAME=asus -# Path where backup will be mounted -MPATH=/media/backup -# UUID of disk -UUID=b162ea95-38bb-42c6-b36a-1be98c65392c -# Mount additional arguments -MARGS="-o compress=lzo" -# If disk is encrypted -CRYPT=true -#################################################################### -# Check if running as root -if [ `id -u` -ne "0" ]; then - echo Please run this as root. - exit 1 -fi -set -e - -# Mount disk -PART=$(lsblk -fpl | grep "$UUID" | awk '{print $1}') -if [ -z "$PART" ]; then - echo Disk not detected. Exiting - exit -1 -fi -if $CRYPT; then - echo -e "\e[1;33mDecrypting filesystem\e[0m" - # TODO what if already opened - cryptsetup open "$PART" backup || (echo Decryption failed && exit -2) - PART=/dev/mapper/backup - echo $PART -fi -echo -e "\e[1;33mMounting\e[0m" -mkdir -p "$MPATH" -mount $MARGS "$PART" "$MPATH" || (echo Mount failed && exit -3) - -[ -d "$MPATH"/@"$MNAME" ] || (echo There seems to be no subvolume $MNAME && exit -4) - -# Do backup -while read -r DIR; do - echo -e "\e[1;33mBacking up: $DIR\e[0m" - rsync -aAxXS --delete --progress "$DIR" "$MPATH"/@"$MNAME"/ || [ $? -eq 24 ] - # We ignore exit code if rsync detects vanished source file -done <<< "$DIRS" - -# Do snapshot (read only) -(cd "$MPATH"; btrfs subvolume snapshot -r @asus @asus-$(date -u +%y%m%d)) - -# Remove snapshots older than 2 months -# TODO ensure that at least five stays -(cd "$MPATH" -for s in @"$MNAME"-*; do - if [ $(expr $(date +%s) - $(stat -c %Y "$s")) -gt 5529600 ]; then - btrfs subvolume delete "$s" - fi -done) - -# Unmount disk -sync -f "$MPATH"/@"$MNAME" -umount "$MPATH" || (echo Unmount failed. Unmount by hand. && exit -5) -if $CRYPT; then - cryptsetup close backup || (echo Encryption close failed. Do by hand. && exit -6) -fi - -# Store when we did last backup and update i3blocks status -date +"%s" > /home/cynerd/.backup_date -pkill -RTMIN+13 i3blocks - -echo -echo -e "\e[1;34mBackup finished\e[0m" diff --git a/local/bin/vim-project-gen b/local/bin/vim-project-gen deleted file mode 100755 index 6a50ba5..0000000 --- a/local/bin/vim-project-gen +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Generates ctags and cscope files for project. -ctags -R -f .tags -#cscope -Rbq -f .cscope.out |