/tools

Collection of useful short scripts and tools

Primary LanguageShell

==========
a2dp_reset
==========

Reset the a2dp sink by cycling it to HSP and back to A2DP, in order to get rid of any audio delay.

===
avg
===

Calculates the average of space separated numbers given on stdin, parsed as scanf float.
Outputs the average and std dev.

[user@system ~]$ echo 1 1 2 | avg
1.333333        0.577350



===
bat
===

Shows the battery power status in watts for (at least) thinkapd models (/sys/class/power_supply/BAT*/power_now)

[user@system ~]$ bat
      0W
   9.50W



========
bat_days
bat_last
========

Show battery history if it has been cron-logged to /var/log/bat


===
br+
br-
===

Manage brightness of thinkpads/intel based laptops with smooth transitions.


=======
br_show
=======

Set brightness to the current level via dbus, in order to trigger KDE's OSD.


===
btc
===

Check Bitcoin rates on kraken.com


===
cam
===

Trivial example to show the webcam in python


========
colorize
========

Add terminal color escape sequences to text matching a particular sed regex.
Terms and colors come from the COLORIZE_STR environment variable.

COLORIZE_STR := ="SUBSSTITUTION (|SUBSTITUTION)*"
SUBSTITUTION := WHAT COLOR HOW"
WHAT         := Any string
COLOR        := escape sequence for a color, for instace "\033[1;32m"
HOW          := w|l (w: word, colorize just WHAT, l: line, colorize whole line containing WHAT)

export COLORIZE_STR="\
CADET ... AAAA \033[1;32m l|\
CADET ... BBBB \033[1;31m l|\
CADET ... CCCC \033[1;34m l|\
CADET ... DDDD \033[1;33m w|\
CADET ... EEEE \033[1;37m l"
[user@system ~]$ colorize LOG_FILE
[user@system ~]$ ./run_test.sh | colorize | less -r


=================
count_connections
count_gnunets
=================

Count statistics of running GNUnet experiments

=================
create_vnc_screen
=================

Create a virtual screen and starts a vnc server to use another computer as a secondary screen.


============
dbus_suspend
============

Suspend to ram sending a dbus query, doesn't need root privileges.


=======
deauth
=======

Deauth a station from a wifi network
[user@system ~]$ deauth SSID BASE_MAC STA_MAC IF


=====
debug
=====

Launch gdb with the first core file available in the pwd. Optionally, specify the PID of the core file.
It expects /proc/sys/kernel/core_pattern to be core.%p.%E


=
f
=

[user@system ~]$ f test_cadet.log 11:16:32-327031 11:18:01-129905

Show the portion of the file test_cadet.log between occurrences of 11:16:32-327031 and 11:18:01-129905,
with 1000 lines before and after.


=
g
=

[user@system ~]$ g test_cadet.log ERROR 4 20

Show the 4th occurrence of ERROR in the file test_cadet.log, optionally with 20 lines of context (default 5).

================
gnunet-deb-build
================

Install all necessary debian packages to build GNUnet.


====
gwif
====

Find the interface which routes the default traffic.

[user@system ~]$ gwif
eth0


=
h
=

[user@system ~]$ h test_cadet.log

Show the first ERROR in the logfile and the 10k lines leading to it.

=========
highlight
=========

Highlight a string in a text (with escape codes). Admits regular expressions or some special marks like "IP".
$ ifconfig | highlight IP
$ cat <text_file> | highlight <string>


=======
install
=======

Install scripts: copy all shell scripts to the target directory stripping the extenstion.


=========
log_slice
=========

Show the contents of the GNUnet cadet log for a selected log fragment. The idea is to view logs with high
level logging (WARNING, INFO), select a fragment and with a hotkey, show the complete DEBUG version, colorized.


==
lx
==

Translate the clipboard word DE <-> EN


===========
meta-update

===
own
===

Find out which package owns a specific executable in Arch.


=
p
=

[user@system ~]$ p A test_cadet.log -C 5 > A
Filter the lines of a log generated by a certain GNUnet peer.
Needs peers with IDs in the form of XXXX (use gnunet/contrib/A-Z.ecc for identities).


============
pacman_conky
============

Show Arch update status from conky.


=============
pacman_notify
=============

Show periodic notifications of the packages that can be updated using kdialog,
for instance from a cron task.


===========
pacman_pony
===========

Let some ponies notify the user about any pending pacman updates, to use with cron.


===========
pacman_sync
===========

Sync pacman database only on whitelisted high-bandwidth connections, avoiding
using too much traffic on modem and mobile hotspots. This allows to set it as 
a cron task on mobile systems like laptops.

Set your wireless interfaces and allowed SSIDs in environmental variables.
If the SSID has spaces, substitute them for underscores ( _ ).

[user@system ~]$ grep PACMAN_SYNC ~/.bashrc
export PACMAN_SYNC_WIFI="wlan0 ath0"
export PACMAN_SYNC_SSID="linksys eduroam home_wifi"
[user@system ~]$ pacman_sync
Synching pacman at 01:27 on home wifi...



===============
remote_chromium
===============

Lauch chromium connecting to a remote ssh and using it as a proxy. 

Stores the configuration at $HOME/.config/.remotes/. Each config dir should have the format

NUM-remotehost

Where NUM is for ordering and remotehost is the name of the host. It should be possible to connect
with public key to the host.

[user@system ~]$ remote_chromium HOST # starts chromium using HOST as a proxy
[user@system ~]$ remote_chromium      # starts chromium for each host in $HOME/.config/.remotes/


===
rmf
===

Play RMF FM (polish radio), muting ads and updating artist and song in /tmp/rmf/.


=========
screenoff
=========

Turn screen off. Twice.


====
ssid
====

Show the SSID of a particular wifi card (wlan0 if none given).

[user@system ~]$ ssid wlan1
linksys


======
ticker
======

Show stock market info, either CLI or conky


[user@system ~]$ ticker.sh
${color1}STOCK1 $color +1.00% | ${color1}STOCK2 $color -1.00% | ${color1}STOCK3 $color +2.00% [...]
[user@system ~]$ ticker.sh full
 Symbol Current   Change Change%  |   Close    Open Current      Min       Max        Stand  Volume
 STOCK1 100.888 (  +0.99  +1.00%) |  99.888  99.890 100.988 ( 99.714 - 108.075) 03/07 14:35  100000
 [...]

===========
tmux-switch
===========

Switch tmux pane and blink the new pane briefly. Takes the same arguments as
tmux select-pane (-U, -D, -L, -R).


============
TorrentMagic
============

Open .torrent files and Magnet links in a remote server with deluge installed.
Requires a mounted share to the auto-torrent directory of the server (NFS, sshfs, ...).
Uses KDE notification system.

Before use, adjust the REMOTE and AUTO_DIR variable to your mount point and auto-torrent 
directory name, respectively.


=========
TVenLinux
=========

Spanish TV streaming (not mine) from http://tvenlinux.com/.



=====
tvoff
=====

rmmod all tuner kernel modules for em28xx_dvb


==================
wallpaperswide-dwl
==================

Dowload all file from the current clipboard wallpaperswide URL category

< select wallpaperswide.com subcategory URL >
[user@system ~]$ wallpaperswide-dwl


=======
wap/wap
=======

Create a wifi access point.

[root@system ~]# wap CONF_DIR [IFACE] [--secure];

 CONF_DIR must be in the same directory as the executable or be an absolute path.
 Two example config directories are provided.

 IFACE defaults to wlan0

 without '--secure' the connected devices won't be able to connect to the host
 or any private subnet 

 The access point will have a DHCP and DNS dnsmasq server, giving clients IPs in the
 192.168.8/24 subnet for the first AP and 192.168.9/24, etc. for the next ones.

wap/complex_5/IP
example of personalized subnet

wap/complex_5/no_nat
disable nat for this WiFi (empty file)